These are issues that arise from transaction concurrency.
There are five levels of transaction isolation:
Transaction_none does not use transactions.
transaction_read_uncommitted allow dirty reads.
Transaction_read_committed prevents dirty reads, the most common isolation level, and is the default isolation level for most databases
Transaction_repeatable_read can prevent dirty reads and non-repeatable reads,
Transaction_serializable can prevent dirty reads, non-repeatable reads, and Phantom reads (transactional serialization) to reduce database efficiency
Basic concepts
Stolen dirty read:
One transaction reads data that is not committed by another transaction
Avoidable scenarios: Read Committed reads commits, a transaction is committed and then read.
The default level for most databases is read committed, such as SQL Server, Oracle.
Non-repeatable READ:
In the same transaction, read the same data two times to get different content
Avoidable scenario: (That is, the implementation can be read repeatedly), the database transaction isolation level repeatable read. One transaction A is in progress, and another transaction B is not allowed to manipulate the data involved in this transaction.
The default isolation level for MySQL is repeatable read.
Phantom read:
The same transaction, read two times with the same operation, resulting in a different number of records
Phantom reading is a phenomenon that occurs when a transaction is not executed independently, such as when the first transaction modifies data in a table that involves all rows of data in the table. At the same time, the second transaction also modifies the data in this table, which is a change to a table
Inserts a new row of data into the Then the user who will be working on the first transaction in the future finds that there are no modified rows of data in the table, as if the illusion had occurred.
Scenarios that can be avoided:
Serializable: is the highest transaction isolation level, at the expense of the highest cost, performance is very low, generally rarely used, at this level, the transaction order execution, not only can avoid dirty read, non-repeatable read, but also avoid phantom read.
" Reference link "
http://blog.csdn.net/jiesa/article/details/51317164
http://blog.csdn.net/gaoshan_820822/article/details/4582561
Database stolen, non-repeatable read, Phantom read