A detailed analysis of the ACID properties of the database

Source: Internet
Author: User

Acid refers to the four characteristics of things in a database management system (DBMS): atomicity, consistency, isolation, persistence

Things: In a database system, a transaction is a complete logical process consisting of a series of successive database operations. Before and after this set of operations is performed, the system needs to be in a predictable, consistent state.

1, atomicity: In one thing all operations are either successful or fail more. If bank transfer, A to B account transfer 1000 yuan, here can be divided into three operations, 1.A to B transfer, 2. Bank processing, 3.B account received transfer. Atomicity is to ensure that all three operations are either successful, or more failures, if 1, 2 operation succeeded, 3 failed, then 1, 2 operations to be rolled back

2, consistency: Before and after the transaction execution, the database consistency constraint has not been destroyed. Consistency in ACID contains entity integrity constraints that are not broken, integrity contains entity integrity (the primary attribute is not empty), referential integrity (foreign keys must exist in the original table), and user-defined integrity. For example, the column value is non-null (NOT NULL), the column value is unique (unique), the column value satisfies a BOOL expression (CHECK statement, such as the gender can only have two values, the age is a certain range of integers, etc.), such as an smallint CHECK (ages >=0 and Age <= 120). The database guarantees that the value of the date is in the range of [0, 120], and if not in this sample, then the update operation fails and the transaction fails.

3. Isolation: Isolation refers to the non-interference between two things. There are two main ways to realize the isolation of things. 1. Yoke, 2. Multi-version control.

SQL defines 4 levels of isolation:

  read_uncommitted
  read_committed
  Repeatable_read
  SERIALIZABLE

4. Persistence: Changes made to the database by things persist in the database and are not rolled back. Persistence needs to take into account the various anomalies that may occur during the execution of a thing and handle the exception accordingly.

A detailed analysis of the ACID properties of the database

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.