Brief summary of the isolation level of database transactions, Database Transaction Level

Source: Internet
Author: User

Brief summary of the isolation level of database transactions, Database Transaction Level

There are four transaction isolation levels in the database: Read uncommitted, Read committed, Repeatable read, and Serializable. These four levels can solve dirty reads, non-repeated reads, and Phantom reads one by one.

If the current isolation level is Read uncommitted, dirty reads may occur, that is, temporary write data that has not been submitted may be Read.

If the current isolation level is Read committed, it can avoid dirty reads, but may cause non-repeated reads. That is, when two transactions modify the same data at the same time, the data consistency and integrity are damaged. Most databases use Read committed by default, such as SQL Server and Oracle.

If the current isolation level is Repeatable read, you can avoid repeated reads, that is, when two or more transactions read the same data, the database selects the readable and writable transaction for the first data access, and the read-only transaction for the second and later transactions. Although this can avoid repeated reads, when transaction A reads the same data twice, if another transaction that can read or write the database modifies the data during the period, therefore, the results of two data reads by transaction A are likely to be inconsistent, that is, phantom read.

The highest level of transaction isolation in the database during Serializable serialization. At this level, transactions are executed in order to avoid dirty reads, repeated reads, and Phantom reads, however, the cost is high and the performance is low.

Related Article

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.