Storage & tuples

Hint bits

Also called: commit hint bits, HEAP_XMIN_COMMITTED

To know whether a row is visible, PostgreSQL must know whether the transaction that created or deleted it committed. Checking the commit log every time is expensive, so the first reader that resolves the answer writes it onto the row as a tiny flag, a hint bit. Later readers trust the flag and skip the lookup.

What this means

Deciding whether a row is visible means knowing whether the transaction that wrote it committed, a lookup in the commit log that's slow to keep repeating. So the first reader that works out the answer scribbles it onto the row as a single bit. Every reader after that trusts the note and skips the lookup.

Why it matters operationally

Setting hint bits modifies the page, so the first SELECT after a write can dirty buffers and cause extra I/O, a common surprise when a read-only query unexpectedly writes. It is harmless and self-correcting: once the bits are set, future reads are cheap.

Related & next

Heap Pruning, the other reason a SELECT can writeMVCC, the visibility rules hint bits cacheCheckpoint, how dirtied pages reach disk

← All glossary terms · GUC reference · Error catalog