Module 6 · Logging and recovery
Episode 41 Write-Ahead Logging
▶ This video is coming to YouTube soon.
Why can't a database just write its pages? This episode plays out steal/no-steal and force/no-force, builds a write-ahead log record by record, enforces the WAL rule, and shows group commit, then reads a real UPDATE out of Postgres's WAL with pg_walinspect: the record, the full-page image, the page LSN, and COMMIT waiting for the flush.
Chapters
- 0:00Intro
- 0:14COMMIT, then the power fails
- 0:34Pages alone can't keep both promises
- 1:50Steal or not, force or not
- 2:30Log first: every change becomes a record
- 3:43The WAL rule: the log reaches disk first
- 4:49Write-ahead logging in three rules
- 5:15Group commit: one flush, many commits
- 6:04The code: log, then page; flush, then commit
- 6:37Postgres: the same rules, its own records
- 7:14Proof: one UPDATE in the WAL
- 8:16Proof: COMMIT is the flush
- 9:14Trade-offs
- 9:38Recap
- 10:06Next: Checkpoints and ARIES