Four isolation levels for a database transaction

Source: Internet
Author: User
Tags serialization

Four isolation levels for a "3" transaction.

Transaction ISOLATION level Dirty read non-repeatable read Phantom read
read_uncommitted allow allow allowed
read_committed prohibit allow allowed
Repeatable_read prohibit the prohibition of permission
SERIALIZABLE prohibition against prohibition


read_uncommitted (Unauthorized Read):
----> is also known as READ UNCOMMITTED to allow dirty reads, but updates are not allowed to be lost.
----> If one transaction has started writing data, the other transaction does not allow simultaneous writes, but allows other transactions to read the data on this line. This isolation level can be achieved by "exclusive write lock"
----> This is the lowest isolation level for transactions, which allows another transaction to see the uncommitted data for this transaction.

Read_committed (Authorized Read):
----> Also known as read Committed: Allows non-repeatable reads, but dirty reads are not allowed.
----> This can be achieved through "instantaneous shared read lock" and "exclusive write lock".
----> Transactions that read data allow other transactions to continue to access the row's data, but uncommitted write transactions will prevent other transactions from accessing the row.

Repeatable_read (Repeatable Read):
----> Repeatable reads (REPEATABLE READ):
----> Prohibit non-repeatable reads and dirty reads, but phantom data can sometimes occur.
----> This can be achieved through "shared read lock" and "exclusive write lock".
Transactions that----> read data will prohibit write transactions (but allow read transactions)
----> Write transactions prohibit any other transactions

SERIALIZABLE (serialization):
----> Serialization (Serializable): Provides strict transaction isolation.
----> It requires transactional serialization to execute, and the transaction can execute only one after the other, but not concurrently.
----> If transaction serialization is not possible only through row-level locks, other mechanisms must be ensured that the newly inserted data is not accessed by the transaction that just performed the query operation.

Four isolation levels for a database transaction

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.