Database isolation level

Source: Internet
Author: User
Transaction is the execution unit of the database management system. It can be a database operation (such as a select operation) or a group of operation series. The acid attributes of a transaction, that is, atomicty, consistency, Isolation, and Durability ). Atomicity: ensures that all operations in a transaction are complete.

Transaction is the execution unit of the database management system. It can be a database operation (such as a select operation) or a group of operation series. The acid attributes of a transaction, that is, atomicty, consistency, Isolation, and Durability ). Atomicity: ensures that all operations in a transaction are complete.

Transaction is the execution unit of the database management system. It can be a database operation (such as a select operation) or a group of operation series. The acid attributes of a transaction, that is, atomicty, consistency, Isolation, and Durability ).

Atomicity, either transfer successful or transfer failed !! Successful: The two account amounts change. If one account increases, the other account decreases, and the other account fails, the two account amounts remain unchanged. There will be no more money for one account, and one account loses money !!!


Consistency: ensure that the database always maintains data consistency-the consistency between the transaction operation and the transaction operation. The above bank transfer example shows that the total amount between two accounts is the same no matter whether the transaction is successfully executed or not !!


Isolation: Concurrent execution of multiple things results in the same way as serial execution of multiple things. If everything is executed in a serial manner, the efficiency will be very low. All operations can be performed in ice even if data security is consistent !!!!! For example, two different things can read the same batch of data, so that they can be executed concurrently. In order to control the effect of concurrent execution, they have different isolation levels !!


Durability: after the transaction is executed, the impact on the database is persistent. Even if the database is damaged due to a fault, the database should be able to be restored !!! Generally, logs are used ..




Transaction isolation level (transaction ioslation levels): isolation level is the level of control over transaction concurrency. ANSI/iso SQL classifies it into four levels: Serializable, REPEATABLE READ, READ committed, and READ uncommitted. To achieve the isolation level, the database usually uses a LOCK ). The isolation level is generally used during programming. It is set by the database as to what locks are used !!


Serializable: all transactions are executed serially one by one. This avoids phantom read (phantomreads ). For databases that implement Concurrency Control Based on locks, serialization requires that when you perform a range query (for example, select a user of the age of 10 to 30, you need to obtain the range lock ). If you do not implement concurrent Database Control Based on locks, you need to roll back the transaction when detecting a transaction that violates the serialization operation.


REPEATBLE: All data obtained by the select statement cannot be modified. This prevents data inconsistency before and after reading a 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.