Tracking vacuum progress

In PostgreSQL 9.6, the community introduced a system view many people have been waiting for. For many years, people wanted to track the progress of a vacuum process to see how long things might still take.

pg_stat_progress_vacuum has been invented to address this issue:

test=# \d pg_stat_progress_vacuum  
           View "pg_catalog.pg_stat_progress_vacuum" 
       Column       |  Type   |... 
--------------------+---------+... 
 pid                | integer |... 
 datid              | oid     |... 
 datname            | name    |... 
 relid              | oid     |... 
 phase              | text    |... 
 heap_blks_total    | bigint  |... 
 heap_blks_scanned  | bigint  |... 
 heap_blks_vacuumed | bigint  |... 
 index_vacuum_count | bigint  |... 
 max_dead_tuples    | bigint  |... 
 num_dead_tuples    | bigint  |...

Most of the columns speak for themselves, and ...

Get Mastering PostgreSQL 10 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.