What are the transaction isolation level? MySQL's default isolation level is?

SQL standard defines four levels of isolation:

READ-UNCOMMITTED (read uncommitted)

Lowest isolation level, allowing the read data changes have not been submitted, may cause dirty reads, non-repeatable reads or phantom reads.

READ-COMMITTED (read committed)

Allow concurrent transactions to read data already submitted, can prevent dirty reads, but phantom reads or non-repeatable read may still occur.

REPEATABLE-READ (repeatable read)

Repeatedly read the results of the same field are the same, unless the data is modified their affairs themselves, you can prevent dirty reads and non-repeatable reads, but phantom reads still occur.

SERIALIZABLE (serializable)

The highest level of isolation, full compliance ACID isolation levels. All transactions executed one by one in sequence, it is impossible to produce interference between such matters, that is to say, this level prevents dirty reads, non-repeatable reads and phantom reads.

Supported by default isolation level MySQL InnoDB storage engine is REPEATABLE-READ (can be re-read). We can SELECT @@tx_isolation;view the command

It should be noted that: the difference is that SQL standard InnoDB storage engine REPEATABLE-READ (can be re-read) the use of lower transaction isolation level is the Next-Key Lock lock algorithm, thus avoiding produce phantom read, as opposed to other databases system (such as SQL Server) are different. So supported by default storage engine InnoDB isolation level is REPEATABLE-READ (can be re-read) already fully guarantee transaction isolation requirements, namely to achieve the SQL standard SERIALIZABLE (serialization) isolation level .

Because the lower the isolation level, the less transaction requests a lock, so most of the database system isolation level is READ-COMMITTED (read submission) :, but you know that InnoDB storage engine is used by default REPEATABLE-READ (available re-read) does not have any performance loss.

InnoDB storage engine in the case of a distributed transaction will generally be used SERIALIZABLE (serialization) isolation level.

Guess you like

Origin www.cnblogs.com/kristse/p/Transactionisolationlevel.html