Simple summary of Isolation level for database transactions

Source: Internet
Author: User
Tags readable

There are four isolation levels for transactions in the database, with levels from low to High: READ UNCOMMITTED, Read committed, Repeatable read, and serializable four. These four levels can solve the problems of dirty reading, non-repeatable reading, and Phantom reading one after the other.

If the current isolation level is read UNCOMMITTED, a dirty read may occur, and you can read the temporary write data that has not yet been committed.

If the current isolation level is read Committed, you can avoid dirty reads, but may cause non-repeatable reads, which is the data consistency and integrity that occurs when two transactions modify the same data at the same time. The default level for most databases is read committed, such as SQL Server and Oracle.

If the current isolation level is repeatable read, you can avoid non-repeatable reads, that is, when the same data is currently read by two or more transactions, the database selects the first transaction that accesses the data to be readable and writable, and the second and subsequent transactions are read-only. Although this avoids non-repeatable reads, when a transaction a two reads the same data, if there are other changes to the data during the period of the database-readable writable transaction, the result of two read data from transaction A is very likely to be inconsistent, resulting in a phantom read.

Serializable the highest level of transaction isolation in the database at serialization time, at which the transactions are executed in order to avoid dirty reads, non-repeatable reads, and Phantom reads, but with a high cost and low performance.

Simple summary of 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.