Storage & tuples

Heap pruning

Also called: opportunistic pruning, page pruning, HOT pruning

Heap pruning is the lightweight, on-the-fly cleanup PostgreSQL does to a single page while a query is already looking at it. It reclaims the space of dead row versions on that page and collapses HOT chains, but it stays inside the one page and never touches indexes.

What this means

A quick tidy-up Postgres does to one page while a query is already reading it. It reclaims the space of dead row versions on that page and collapses HOT chains, but it stays inside the one page and never touches indexes, which is what keeps it cheap enough to do on the fly.

Why it matters operationally

Pruning is why dead rows often disappear long before VACUUM runs, and why a plain SELECT can generate WAL and dirty pages. It only removes versions older than the xmin horizon, so a long-running transaction quietly disables it. Full VACUUM is still needed to clean index entries and update the free space map.

Related & next

Heap Pruning & the xmin Horizon, the full mechanismVACUUM, the heavier cleanup pruning complementsxmin horizon, the boundary pruning obeys

← All glossary terms · GUC reference · Error catalog