The goal is not ACID vocabulary; it is preserving an invariant#
Transfer $100 without losing money
1. Debit Account A by $100
2. Credit Account B by $100If only one change commits, total money changes incorrectly. A transaction makes the related state transition one correctness boundary.
ACID as four design tools#
- Atomicity
- All intended changes commit, or none do.
- Consistency
- The transaction preserves declared database and application invariants.
- Isolation
- Concurrent work does not produce a forbidden logical outcome under the chosen guarantee.
- Durability
- A committed outcome survives the failures covered by the storage system's guarantee.
Keep the boundary aligned with the business rule#
An order and its inventory reservation may need coordinated correctness, while an analytics event can arrive later. Larger transactions hold resources longer and can increase contention. Across independent services or shards, coordination becomes harder; later lessons cover distributed transactions and Saga patterns.
Related practice problems
Use the manifest-backed prompts below to apply this lesson in a complete design.
- PostgreSQL data definitionPostgreSQL Documentation
- Transaction isolationPostgreSQL Documentation