Isolation level for database transactions

Source: Internet
Author: User

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.



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.