Four database transaction isolation mode

The four isolation mode is primarily used to solve several problems caused by the different threads of affairs:

1. Modify loss: two panels A, B to read and modify the same data at the same time, to cover the transaction A commits the transaction B results appear

2. Dirty read: A read transaction data modification has not submitted transaction B, B rollback transaction data modification operation, resulting in a transaction A dirty data to obtain data (data to be understood as a transaction database stored in the acquired A the data are inconsistent)

3. The (non-repeatable read) Read dummy: A front will cause the transaction to read a row of data, transaction data B to be diverted to modify transaction B reads the line data again read two inconsistent results.

4. Magic Reading: A reading certain transaction data, transaction B when subjected to insert or delete operation, transaction data inconsistencies when data segment A re-read twice before and after the query result, attained during the occurrence of the first section more or less secondary phenomenon.

To solve the above problems, there are four transaction isolation mode

1.Read uncommitted (not authorized to read, read uncommitted) :( exclusive write lock) at the same time only allows a transaction to be in the presence of a write operation, can allow multiple transactions to read. Can solve the (modified loss) problems, but dirty reads, phantom reads, phantom reads these problems occur

2.Read committed (authorized to read, read committed) :( exclusive write locks, and instantly shared read lock) at the same time only allows a transaction to be written to prohibit other transactions read and write, can be resolved (modify missing, dirty read) can not solve dummy read, phantom read

3.Repeatable read (repeatable read) :( exclusive write locks, shared read lock) at the same time only allows a transaction to be written to prohibit other transactions read and write, when a transaction reads the same time does not allow other affairs write (read). Can be resolved (modify missing, dirty reads, phantom reads), but can not solve the phantom reads.

4. Serialization: Only one transaction in accordance with a sequence for reading and writing, so that performance is not high concurrency, the above problems can be solved 4.

Guess you like

Origin www.cnblogs.com/ynwxownd/p/11587475.html