Dataatomicityconsistency isolation durabilityacid transactions

ACID

Definition

ACID describes transactions that are atomic (all or nothing), consistent (declared constraints hold), isolated (concurrent transactions do not see each other's partial work) and durable (committed data survives a crash).

In practice

Each letter has a mechanism behind it: atomicity comes from marking a transaction committed or aborted in one step, consistency from constraints the database checks on every write, isolation from row versions and locks, and durability from flushing the write-ahead log before COMMIT returns. Together they let application code reason about one transaction at a time.

The C is the weakest letter: the database only enforces invariants you declared, such as foreign keys and CHECK constraints, and everything else is the application's job. Isolation is also a dial, not a switch, and most databases default to a level weaker than serializable. Durability on one machine says nothing about losing that machine; that needs replication.

Example

A transfer debits account 1 and credits account 2 in one transaction; if the server crashes after the debit, recovery discards it, and a CHECK (balance >= 0) rejects an overdraft for every writer.