Isolation level for database transactions

Source: Internet
Author: User

The SQL92 standard stipulates that database transactions have 4 isolation levels in order to prevent the following behavior:

    • Dirty Read (Dirty Read): One transaction has read UNCOMMITTED data from another transaction
      • A transaction modifies a piece of data but is still not committed
      • b Transaction query data, but can read the PEN uncommitted data (if a transaction rollback, this pen data is dirty data, so dirty Read)
    • Non-repeatable read (nonrepeatable Read):
      • A transaction reads a batch of data
      • b Transaction operation or delete the batch data
      • A transaction is read again, it is found that the batch data has been modified or deleted
    • Non-existent read (Phantom Read):
      • A transaction queries a batch of data based on conditions
      • B Transaction Insert Data
      • A transaction re-executes the same condition of the query, the result set is inconsistent

The isolation level for database transactions is:

Isolation level Dirty Read Non-REPEATABLE READ does not exist read
Non-committed read Y Y Y
Read Committed N Y Y
REPEATABLE READ N N Y
Serialization N N N

I think that, based on the atomicity of database transactions, consistency, dirty reading is a heavy priority, this point is very easy to understand.

Non-repeatable read, no read, at first glance as if consistent. In fact, it is not repeatable to read, the database only need to ensure the isolation of the data being manipulated, but there is no read, the database needs to ensure the data isolation of the entire table. So they have different levels.

Isolation level for database 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.