#page-8kb-anatomy
What lives inside an 8 KB page? Name the parts and which way each one grows.
What to say
A page is the unit of reads and writes, 8 KB by default. It has four zones. The header (`PageHeaderData`, 24 bytes): checksum, the LSN of the last WAL record, and the `pd_lower` and `pd_upper` pointers. The array of line pointers grows down from the start. The tuples themselves are placed from the end upward. The special space at the very end holds service data for indexes and is empty in a heap. Free space is the gap between `pd_lower` and `pd_upper`; once that gap collapses, nothing more fits in the page.
What they want to hear
A senior should: - name the four zones and say that pointers and tuples grow toward each other, with free space as the gap between them - explain why the pointer layer exists: a tuple can move within a page (after cleanup), yet its external address `(page, item)` stays the same - know that 8 KB is a compile-time setting (`BLCKSZ`) and cannot change without a rebuild - mention `pageinspect` (`page_header`, `heap_page_items`) as the way to see all of this on a live page
Pitfalls
- ✗ Saying "a tuple sits at a fixed offset". The offset is held by the line pointer, and the tuple itself can move
- ✗ Confusing in-page free space with the FSM. The FSM is a separate map, while the `pd_lower..pd_upper` gap is space in one specific page
- ✗ Thinking 8 KB can be changed in the config. It is the build setting `BLCKSZ`, not a GUC
Follow-up
- ? What does `SELECT * FROM page_header(get_raw_page('t', 0))` show?
- ? Why does `pd_lower` grow on INSERT while tuples come from the other end?
- ? Why does a page carry a checksum, and when is it verified?
Depth in knowledge base