The isolation level corresponds to the problem, and database operations are common problems:
1 Dirty reads: One transaction can read uncommitted data from another transaction
2 non-REPEATABLE READ: One transaction performs a read operation twice in succession, and the returned result is inconsistent and modified
3 Virtual read: One transaction performs a read operation twice in succession, the returned result is inconsistent, the number of records returned is changed
The difference between non-repeatable reads and virtual reads:
Non-repeatable reading, it is emphasized that the result of the second return, an entry has been modified, such as some fields have been modified
Virtual read, emphasizing that the second return result has no change to the entry that belongs to the first return, but the number of returned entries will change
Database Transaction ISOLATION LEVEL
1 READ uncommitted that level of dirty reading
2 Read Committed fix dirty read problem, commit to be read by other transaction (default transaction level for most databases)
3 REPEATABLE Read repeatable reads, how to implement: Specifies that a transaction cannot modify a transaction that is read by another transaction but not committed
4 serializable how the highest transaction isolation level is implemented: All transactions are executed serially
How is repeatable read implemented?
Specifies that a transaction cannot modify other transactional read but uncommitted transactions
This ensures that the data that is read for the second time in a transaction is not modified
Why REPEATABLE Read isolation level, the virtual reading problem is not resolved?
Only the modification is limited, if the two reads between the insertion or delete operation, not modify the other transaction read but uncommitted transactions, the results of two reads will be inconsistent, so the virtual read problem is not resolved
Virtual read problem resolution, Serializable isolation level?
Serialization execution, it is easy to understand, I am in a transaction, performing two read operations, during which no other transactions in the execution, must wait for me to execute after the execution, because it is serial, everyone queued, so the results can not be inconsistent.