Four isolation levels for SQL transactions

Source: Internet
Author: User

1 uncommitted read (READ UNCOMMITTED): Dirty data will appear because the table is not locked.
2 Commit read (Read Committed): 1. Update in transaction 1 locks the table and can select to the latest data.

Transaction 2select cannot find the data. Will always wait. Plus with (NOLOCK) you can read it.
2.select is an unlocked table, so other transactions can modify the data. When there are two select,
The second select will show dirty data. cannot be read repeatedly.

3 REPEATABLE READ (REPEATABLE Read):
To resolve the problem of submitting read non-repeatable reads, the results of two queries are consistent.
This only resolves the data modification (update) results in the same case.
In the case of INSERT, the new data will still be select. This is called Phantom Reading.

4 Serializable (Serializable)
Can solve the phantom reading problem. Event 1 is not in advance, all operations lock the table. Includes select.
The other event actions do not affect event 1.

Four isolation levels for SQL transactions

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.