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