Module 1 · Storage

Episode 4 Slotted Pages

8 min · SQL · Postgres

Title card of Episode 4: Slotted Pages

▶ This video is coming to YouTube soon.

Inside one 8 KB Postgres page: the line pointer array growing forward, rows growing backward, pd_lower and pd_upper, the hole a DELETE leaves and the compaction that closes it. A page simulation predicts every offset, and pageinspect confirms each one.

Chapters

  1. 0:00Intro
  2. 0:16Rows moved, addresses didn't
  3. 0:36Why not point at byte offsets?
  4. 1:15Slots grow forward, rows grow back
  5. 2:16One line pointer: 4 bytes
  6. 2:46A hole, then compaction
  7. 3:48Free slots are reused
  8. 4:30The code: add a row to a page
  9. 5:01The code: compaction
  10. 5:31Proof: one page in pageinspect
  11. 6:41Where Postgres differs from the textbook
  12. 7:11Recap
  13. 7:39Next: Tuple Layout