Lesson 3 of 19
17. Transactions and Locking

17.2 What does ACID mean in depth?

3 min read+10 XP

On the train: The railway promises four things about a ticket. It's complete or not issued. The rules hold (no seat sold twice, no negative fare). Two clerks booking at once don't trip over each other. And once printed, it survives a power cut.

In the system: Chapter 8 introduced ACID in one line each. Here's what each really involves:

PromiseHow databases deliver it
AtomicityAll of the transaction or none of itAn undo or write-ahead log that can roll back partial work
ConsistencyConstraints hold before and afterPrimary keys, foreign keys, UNIQUE, CHECK; plus your application's rules
IsolationConcurrent transactions don't see each other's half-done work, to a chosen degreeLocks and/or multiple versions of rows (MVCC), set by the isolation level (17.5)
DurabilityCommitted means saved, even through a crashWriting the log to disk before confirming the commit; replicas (Chapter 14)

Isolation is the one that surprises people: most databases don't give full isolation by default. PostgreSQL defaults to Read Committed and MySQL's InnoDB to Repeatable Read, and neither stops every race. That's why the rest of this block matters.

Memory code: "Whole, legal, private, permanent." Atomic, Consistent, Isolated, Durable.