Get the App
SLTechnology News&Howtos  ›  Database  › 

Transaction isolation level

Shulou Source: shulou.com Published: 2022-06-01 07:20:51 11月12日 Update

Transaction isolation is one of the foundations of database processing. Isolation is the abbreviation of I in ACID. When multiple transactions make changes and execute queries at the same time, the isolation level is set to fine-tune the balance between performance and reliability, consistency and result reproducibility. MySQL supports the following isolation levels REPEATABLE READ (the default level used by innodb) READ COMMITTEDREAD UNCOMMITTEDSERIALIZABLEREPEATABLE READ (phantom reading problems occur when executing a range query) this is the default isolation level of innodb Consistent reads in the same transaction take the snapshot established by the first read, which means that if you send the same (unlocked) select statements multiple times in the same transaction, the results returned by these SELECT statements are consistent with each other. READ COMMITTED (with non-repeatable read problem) every consistent read, even in the same transaction, sets and reads its own new snapshot READ UNCOMMITTED (dirty read problem) SELECT statement is done in a non-locked way, but an earlier version of the row data may be used, so, using this isolation level, the read is not consistent, which is called dirty read, otherwise, the isolation level works similar to

SERIALIZABLE (dirty reading, non-repeatable reading, and phantom reading problems will not occur)

This level is a bit like REPEATABLE READ, but innodb implicitly summons all SELECT statements to SELECT. LOCK IN SHARE MODE except in cases where autocommit is prohibited, if autocommit is enabled, SELECT is its own transaction. The main function of transaction isolation is to solve the problems of dirty reading, non-repeatable reading and phantom reading caused by concurrency. Please see my next article for details.

Tags: Transactions levels isolation consistency problems statements between data results queries each other consistency action content reliability simultaneously foundation multiple snapshots performance Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei Xiaomi Apple OPPO Reno Shulou Information