Module 5 · Transactions and concurrency control
Episode 32 ACID and Schedules
▶ This video is coming to YouTube soon.
What does a transaction really promise? Atomicity, consistency, isolation and durability, each shown with one picture, then two bank transfers interleaved on a timeline: serial schedules, one that loses $30 and one that's fine. Every claim is checked in Postgres: a ROLLBACK, a CHECK constraint, and two sessions where the second UPDATE waits for the first's row lock.
Chapters
- 0:00Intro
- 0:15Two transfers at once
- 0:33Atomicity: all of it, or none of it
- 1:24Consistency: the rules hold at every commit
- 1:59Isolation: as if each ran alone
- 2:42Durability: committed means kept
- 3:27Serial schedules: one at a time
- 4:12An interleaving that loses $30
- 4:52An interleaving that's fine
- 5:24Four schedules, two transfers
- 5:46The code: a transfer as one transaction
- 6:16Proof: rollback and a CHECK in Postgres
- 7:24Proof: two transfers, two sessions
- 8:24Who keeps each promise
- 8:50Recap
- 9:15Next: The Anomalies