May 2018
Intermediate to advanced
576 pages
30h 25m
English
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:
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
The number of blocks vacuumed is shown as heap_blks_vacuumed and the resulting rows to be removed are shown as num_dead_tuples. After this we switch to the second phase where we start vacuuming indexes:
Pid | 34399 datid | 12515 datname | postgres relid | 16422 phase | vacuuming indexes heap_blks_total | 32787heap_blks_scanned | 32787 heap_blks_vacuumed ...