Updated on 2024-05-31 GMT+08:00

Other Statements

No.

Description

Syntax

Difference

1

Transaction-related syntax

Default database isolation level

The default isolation level of M-compatible mode is READ COMMITTED, and that of MySQL is REPEATABLE READ.

Only the READ COMMITTED and REPEATABLE READ isolation levels take effect in M-compatible databases.

2

Transaction-related syntax

Transaction nesting

In M-compatible mode, nested transactions are not automatically committed, but in MySQL, they are automatically committed.

3

Transaction-related syntax

Autocommit

In M-compatible mode, GaussDB is used for storage and the GaussDB transaction mechanism is inherited. If DDL or DCL is executed in a transaction, the transaction is not automatically committed. In MySQL, if DDL, DCL, management-related, or lock-related statements are executed, the transaction is automatically committed.

4

Transaction-related syntax

Rollback is required after an error is reported.

If an error is reported for a transaction in an M-compatible database, rollback needs to be performed. There is no such restriction in MySQL.

5

Transaction-related syntax

Lock mechanism

The M-compatible lock mechanism can be used only in transaction blocks. There is no such restriction in MySQL.

6

Lock mechanism

Lock mechanism

  • After the read lock is obtained, write operations cannot be performed on the current session in MySQL, but write operations can be performed on the current session in an M-compatible database.
  • After MySQL locks a table, an error is reported when other tables are read. M-compatible does not have such restriction.
  • In MySQL, if the lock of the same table is obtained in the same session, the previous lock is automatically released and the transaction is committed. M-compatible databases do not have this mechanism.
  • M-compatible databases allow LOCK TABLE to be used only inside a transaction block, and have no UNLOCK TABLE command. Locks are always released at the end of transactions.