skip to content
16, 11 chapters
WAL and recovery

WAL and recovery

write-ahead logging, LSNs, checkpoints, crash recovery, backups and replication.

start part 16part 16 of 18, 11 chapters
  1. 16.01the write-ahead rulelog first, data later. why a commit only has to write one small sequential thing.
  2. 16.02WAL records and LSNspg_walinspect on a real INSERT: record types, lengths, and the blocks each record touches.
  3. 16.03what COMMIT waits forthe commit record, the flush, group commit, and what synchronous_commit = off really risks.
  4. 16.04torn pages and full-page writesan 8 KB page, a 4 KB disk write, and why the first change after a checkpoint logs the whole page.
  5. 16.05checkpointsflushing dirty pages, the redo pointer, and the trade between recovery time and steady I/O.
  6. 16.06crash recoverykill the server, restart, replay from the redo pointer. pages newer than a record get skipped.
  7. 16.07ARIESanalysis, redo, undo. the textbook recovery algorithm, and why postgres only needs the middle pass.
  8. 16.08data checksumson by default since postgres 18. what a checksum catches, and what it can't.
  9. 16.09backups and point-in-time recoverypg_dump vs base backups, WAL archiving, and restoring to 14:31:59, the second before the mistake.
  10. 16.10streaming replicationa standby replaying WAL as it arrives. lag, hot standby conflicts, and synchronous replicas.
  11. 16.11logical replication and decodingshipping row changes instead of page changes. publications, slots, and change data capture.