VACUUM works in three phases:
- The first main phase is scanning heap. The heap_blks_scanned columns will increase from 0 up to the value of heap_blks_total. The number of blocks vacuumed is shown as heap_blks_vacuumed, and the resulting rows to be removed are shown as num_dead_tuples:
Pid | 34399 datid | 12515 datname | postgres relid | 16422 phase | scanning heap heap_blks_total | 32787 heap_blks_scanned | 25207 heap_blks_vacuumed | 0 index_vacuum_count | 0 max_dead_tuples | 9541017 num_dead_tuples | 537600
- After this, we switch to the second phase, where we start vacuuming indexes. In PostgreSQL 11, it's possible that we can skip scanning the indexes altogether, so you may find that VACUUM is faster in this release. You ...