Full-page writes and torn pages
also full page image, FPI, torn page, full-page write
The first change to a page after a checkpoint puts the whole 8 KB page in WAL, so recovery can overwrite a half-written page instead of patching it.
AnalogyBefore the first edit to a form, photocopy the whole sheet. Later edits are pencil marks; if the sheet tears, you start again from the copy and redo the marks.
Where it breaksThe copy is taken once per checkpoint, not once per form. After the next checkpoint the first edit copies the sheet again, which is why WAL swells right after one.
Lazy transaction id assignment
also lazy xid, virtual transaction id, xid
A transaction gets its 32-bit xid on its first write, not at BEGIN; until then it runs under a virtual id, so a read-only transaction never uses one up.
AnalogyA counter that hands out numbered tickets only to people who order. Whoever reads the menu and leaves never takes a ticket, so the numbers last longer.
Where it breaksA ticket, once taken, is never handed back. A transaction that rolls back has still used its xid; the counter only moves forward, and wraparound is measured against it.
pd_lsn vs record LSN
also page LSN, record LSN, LSN, pd_lsn
An LSN is a byte address in the WAL stream. A record's LSN is where it sits; a page's pd_lsn is the address just past the last record applied to that page.
AnalogyPage numbers in a diary. Each entry has its page, and each thing you own is marked with the page of the last entry about it, so you know which entries it already reflects.
Where it breaksTwo diaries never share page numbers. An LSN means something only inside the server it came from, so comparing LSNs across machines compares nothing.
In the source: bufpage.h

↑↓ move · ↵ open · esc close