The ACID Database Model

ACID protects your database's information

The ACID model of database design is an important concept of database theory. It sets four goals that a database management system must achieve: atomicity, consistency, isolation, and durability. A relational database that fails to meet any of these four goals cannot be considered reliable. Conversely, a database that possesses these characteristics is considered ACID-compliant.

ACID, Defined

Each of the four ACID attributes follows well-defined standards:

  • Atomicity states that database modifications must follow an all-or-nothing rule. Each transaction is said to be atomic. If one part of the transaction fails, the entire transaction fails. It is critical that the database management system maintains the atomic nature of transactions in spite of any DBMS, operating system, or hardware failure.
  • Consistency states that only valid data will be written to the database. If a transaction is executed that violates the database's consistency rules, the entire transaction is rolled back, and the database is restored to a state consistent with those rules. On the other hand, if a transaction successfully executes, it takes the database from one state that is consistent with the rules to another state that is also consistent with the rules.
  • Isolation requires that multiple transactions occurring at the same time not impact each other's execution. For example, if Joe issues a transaction against a database at the same time that Mary issues a different transaction, both transactions should operate on the database in an isolated manner. The database should either perform Joe's transaction before executing Mary's or vice-versa. This prevents Joe's transaction from reading intermediate data produced as a side effect of part of Mary's transaction that will not eventually be committed to the database. The isolation property does not ensure which transaction executes first—only that transactions will not interfere with each other.
  • Durability ensures that any transaction committed to the database is not lost. Durability is ensured by using database backups and transaction logs that facilitate the restoration of committed transactions despite any subsequent software or hardware failures.

How ACID Works in Practice

Database administrators use several strategies to enforce ACID.

One strategy used to enforce atomicity and durability is write-ahead logging, in which any transaction detail is first written to a log that includes both redo and undo information. This approach ensures that, given a database failure, the database can check the log and compare its contents to the state of the database.

Another method used to address atomicity and durability is shadow-paging, in which a shadow page is created when data is to be modified. The query's updates are written to the shadow page rather than to the real data in the database. The database is modified only when the edit is complete.

Another strategy is called the two-phase commit protocol, especially useful in distributed database systems. This protocol separates a request to modify data into two phases: a commit-request phase and a commit phase. In the request phase, all DBMSs on a network that are affected by the transaction must confirm that they received it and have the capacity to perform the transaction. Once confirmation is received from all relevant DBMSs, the commit phase completes in which the data is modified.

The ACID model isn't the only approach to managing data. The BASE model works well with unstructured data.

Was this page helpful?