The Four ACID Properties

A — Atomicity

A transaction is all-or-nothing. If any part fails, the entire transaction rolls back as if it never happened.

C — Consistency

A transaction can only move the database from one valid state to another, never violating constraints or rules.

I — Isolation

Concurrent transactions don't interfere with each other — each one behaves as if it ran alone.

D — Durability

Once a transaction commits, it survives a crash, power loss, or restart — it's permanently saved.

The Bank Transfer Example

The classic way to understand ACID is a money transfer between two accounts:

transfer.sql BEGIN TRANSACTION; UPDATE accounts SET balance = balance - 500 WHERE id = 'A'; UPDATE accounts SET balance = balance + 500 WHERE id = 'B'; COMMIT;
  • Atomicity: if the second UPDATE fails (e.g. account B doesn't exist), the first UPDATE is rolled back too — money is never deducted without being credited somewhere.
  • Consistency: a constraint like balance >= 0 ensures the transfer is rejected if it would overdraw account A.
  • Isolation: if another transaction reads account A's balance while this transfer is mid-flight, it sees either the balance before or after the transfer — never a half-updated value.
  • Durability: once COMMIT returns successfully, the new balances are on disk — even if the server loses power one millisecond later.

Isolation Levels and the Problems They Prevent

Isolation LevelDirty ReadNon-Repeatable ReadPhantom Read
Read UncommittedPossiblePossiblePossible
Read CommittedPreventedPossiblePossible
Repeatable ReadPreventedPreventedPossible
SerializablePreventedPreventedPrevented
  • Dirty read: reading another transaction's uncommitted changes.
  • Non-repeatable read: re-running the same query twice in one transaction gives different results because another transaction committed in between.
  • Phantom read: a range query returns a different set of rows the second time, because rows were inserted/deleted in between.

⚠️ Higher Isolation = Lower Concurrency

Serializable isolation gives the strongest guarantees but forces transactions to effectively run one at a time when they conflict, hurting throughput. Most production systems default to Read Committed or Repeatable Read as a practical middle ground.

ACID vs BASE

AspectACIDBASE
Stands forAtomicity, Consistency, Isolation, DurabilityBasically Available, Soft state, Eventually consistent
Consistency modelStrong — always consistentEventual — converges over time
Typical systemsPostgreSQL, MySQL, Oracle, SQL ServerCassandra, DynamoDB, early MongoDB
Optimised forCorrectness, financial/transactional dataAvailability, partition tolerance, scale
Trade-offHarder to scale horizontallyTemporary inconsistency is acceptable

This trade-off connects directly to the CAP theorem — under a network partition, a system must choose between consistency and availability, and ACID systems generally lean toward consistency.

💡 Most NoSQL Databases Now Offer Partial ACID

MongoDB has supported multi-document ACID transactions since version 4.0. The SQL vs NoSQL line is no longer "ACID vs no ACID" — it's more about data model fit, scale requirements, and operational complexity.

How We Research and Update This Guide

We test the underlying formula or workflow, compare outputs with reliable references, and revise examples whenever the page content changes.

  • The workflow or formula is tested directly in the tool and compared against independent reference examples.
  • Examples are kept practical so readers can verify the result without hidden assumptions.
  • Pages are revised whenever the interface, calculation flow, or surrounding guidance materially changes.

Frequently Asked Questions — ACID Properties