Storage & tuples

NULL bitmap

Also called: null bitmask, t_bits, HEAP_HASNULL bitmap

The NULL bitmap is a compact run of bits in the tuple header (t_bits[]), one bit per column, recording which columns are NULL. A 0 bit means that column is NULL and is not stored in the row body at all. The bitmap is present only when the row actually contains at least one NULL, signalled by the HEAP_HASNULL flag.

What this means

A small run of bits in the row header, one per column, marking which columns are NULL. A NULL column isn't stored in the row body at all, its bit is simply set to 0. The map only exists when the row actually has a NULL, so rows with none don't pay for it.

Why it matters operationally

NULLs are nearly free on storage, a NULL column takes one bit, not a full value, but the bitmap also affects deforming: once a NULL appears, the cached offset shortcut (attcacheoff) can no longer be used for columns after it, so they must be reached by sequential deforming.

← All glossary terms · GUC reference · Error catalog