Chapter 6 of 10All chapters
Chapter 6 of 10
Transactions
All or nothing, even under load.
ACID
A transaction is atomic, so it either fully happens or not at all. It leaves the data consistent, runs isolated from others, and once committed is durable through a crash.
- Moving money is the classic case: both sides of the transfer or neither.
- Isolation levels trade strictness against concurrency, and the default varies by database.
Concurrency
Two users editing the same row is normal, not exceptional. Optimistic locking with a version column is usually enough, and it beats silently overwriting someone's work.