Database Features and isolation level description

A four major characteristics (the ACID) transaction 
atomicity (Atomicity): Atomicity means that a transaction is an indivisible unit of work operations in the transaction either all succeed or all fail. 
Consistency (Consistency): Transaction database must be transformed from one consistent state to another consistent state. 
Isolation (Isolation): when a plurality of users concurrent access to the database, the user opens a database for each transaction, the operation data can not be disturbed by other transactions, for isolation between a plurality of concurrent transactions. 
Persistent (Durability): Persistence means that once a transaction is committed, it changed data in the database is permanent, then even if the database fails nor should it have any impact. 


Second, the problem is not considered a transaction isolation may lead to 
1. Dirty read: A transaction reads data of another uncommitted transactions. 
2. Non-repeatable read: non-repeatable read means read a data table row in a transaction, several different reading result. 
3. The phantom read: Dummy read (read phantom) means within a read transaction to insert other transaction data, resulting in inconsistent reading. 


Third, the isolation provided statement transaction 
1.Read uncommitted: a transaction data can be read another uncommitted transactions, dirty reads, non-repeatability and phantom read are inevitable. 
2.Read committed: a transaction to wait to read another transaction after the submission of data, to avoid dirty reads, unrepeatable magic of reading and inevitable. 
3.Repeatable read: at the start of the read data (open transaction), the operation is no longer allowed to modify (i.e., does not allow other transactions update operation), and can not prevent dirty reads repeatability, but can not avoid phantom read. 
4.Serializable: highest transaction isolation level, at the level of transaction serialization order of execution, to avoid dirty reads, non-repeatable reads and phantom reads. But this is inefficient transaction isolation level, database comparison consumption performance, is not generally used. 


Note: Most of the default database transaction isolation level is Read committed, such as Sql Server, Oracle. Mysql default isolation level is Repeatable read. In the MySQL database, support for the above four isolation levels, the default is Repeatable read (repeatable read); and in the Oracle database, the only support Serializable (serialized) level and Read committed (Read Committed) Both levels ,

Published 327 original articles · won praise 566 · Views 2.63 million +

Guess you like

Origin blog.csdn.net/vtopqx/article/details/104770805