liveBook · Manning

ACID

As explained in The Coder Cafe

ACID is a set of database transaction properties—atomicity, consistency, isolation, and durability—that define reliable transaction behavior.

ACID names four transaction properties—atomicity, consistency, isolation, and durability. Together, they describe a reliability contract a single-node relational database can offer, including when a crash or power failure interrupts work. section 6.1.1

Each property answers a different question about a transaction:

  • Atomicity: Did all its operations succeed? If one fails, the transaction rolls back rather than leaving only some changes in place. section 6.1.1
  • Consistency: Does the transaction move the database from one valid state to another? Database rules include foreign keys and data types, but some required invariants belong to the application. section 6.1.1
  • Isolation: How do concurrent transactions interact? Isolation levels offer different guarantees, with stronger levels carrying performance costs. section 6.15
  • Durability: Does data remain reliable through a crash or power failure? It is the failure-survival part of the ACID contract. section 6.1.1

A bank transfer

A transfer deducts money from one account and adds it to another. Atomicity means that if either operation fails, both are rolled back; neither account is left with only half the transfer applied. section 6.1.1

ACID does not make every application rule a database rule. A requirement such as keeping the sum of customer balances positive is an application-level invariant. Nor does a single database transaction automatically make a database write and a Kafka message one atomic operation: that guarantee would have to cover the whole system. Across multiple nodes, reliability guarantees face further scalability and performance trade-offs. section 6.1.1 section 6.15

How The Coder Cafe covers it

How deep it goes
Defines atomicity and consistency with examples, while naming isolation and durability without detailing their mechanisms here.
Examples
Uses a bank transfer, foreign key constraints, customer balances, and a database write paired with a Kafka message.
What it assumes
Introduces the four ACID terms explicitly, while using transactions and basic database operations as context.
What you can do after
Evaluate/understand which transaction promises a database offers and which invariants or cross-system guarantees need separate attention.
How it connects
Connects transactions to integrity constraints, application invariants, isolation levels, CAP, and PACELC.

Also explained in

Compare how 10 books explain ACID →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of The Coder Cafe. The section links point to the parts of the book it draws on.