Module 1 · Storage
Episode 5 Tuple Layout
▶ This video is coming to YouTube soon.
Every byte of a Postgres row: the 23-byte header, t_hoff, alignment padding (why column order changes table size by 13%), the null bitmap, 1- and 4-byte varlena headers, and TOAST compression and chunking. A layout simulation predicts each size; pageinspect confirms it.
Chapters
- 0:00Intro
- 0:16Same columns, fewer pages
- 0:3730 bytes of data, 60 bytes of row
- 1:28The 23-byte header
- 2:08Alignment: column order matters
- 2:56A NULL costs a bit, not bytes
- 3:38Too big for the page: TOAST
- 4:28The code: how long is a row?
- 5:08Proof: every byte in pageinspect
- 6:33What a value costs
- 7:09Recap
- 7:40Next: Row vs. Column vs. PAX