How Write-Ahead Logging Lets Databases Recover From Crashes
Databases must confirm committed data is durable even though they keep most changes in memory and write pages to disk lazily. The write-ahead log resolves this by requiring that a record of each change is safely flushed to an append-only log before the corresponding data page can reach disk. Sequential log writes are faster than scattered page writes, and concurrent commits can share a single flush. After a crash, recovery replays the log from the last checkpoint, reapplying changes whose LSN is newer than the page's on-disk LSN. How uncommitted transactions are handled depends on the engine, with PostgreSQL treating them as aborted via row-version metadata and InnoDB using a separate undo log.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in