BitPage

🔍 #Pgstattuple

Clear filter

PostgreSQL index bloat: why VACUUM never shrinks an index, and how to measure it with avg_leaf_density

A b-tree that has lost most of its keys keeps every page it allocated: PostgreSQL reclaims completely empty index pages, but a page with a few keys left on it stays put, and no autovacuum setting changes that. Measure the damage with pgstatindex.avg_leaf_density against the b-tree default fillfactor of 90, predict the recovery as size x density / 90, and fix it with REINDEX rather than VACUUM FULL.