[Database principle] transaction isolation level

Source: Internet
Author: User
Concurrency and Data Reading

When multiple sessions simultaneously access (operate) the same data, unexpected results may occur, including:

-Dirty read -- dirty reads
-Non-repeatable reads
-Phantom read-Phantom reads

1. Dirty read refers to when a transaction is accessing data and modifying the data, but the modification has not been committed to the database, another transaction also accesses the data and then uses the data. Because the data has not been committed, the data read by another transaction is dirty data. The figure below may be better understood: 2. Non-repeated reads and non-repeated reads indicate that two identical queries within a transaction range return different data during database access, this is because the data has been modified and committed by other transactions in the system during the query. For example, when transaction T1 reads a data, transaction T2 reads and modifies the data, and T1 reads the data again, it is found that it is different from the first read.
As shown in the following figure: 3. When Phantom reads the same SQL statement twice in the same transaction, the result set is different.
Transaction isolation level (ANSI defined level)
The four transaction isolation levels defined by ANSI in the standard organization:

 

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.