This article is half-done without your Comment! *** Please share your thoughts via Comment ***
In this post, I am sharing a system view which we can use to check the progress of running vacuum process of PostgreSQL.
PostgreSQL based on MVCC, and in this architecture VACUUM is a routine task of DBA for removing dead tuples.
Now the question is, How to monitor the progress of VACUUM?
Simple, we can use pg_stat_progress_vacuum view for this purpose. In this view, we can check phase column which indicates the different stages of running the vacuum.
1 |
select * from pg_stat_progress_vacuum |
Type of phases:
initializing: VACUUM is preparing to begin scanning the heap
scanning heap: VACUUM is currently scanning the heap
vacuuming indexes: VACUUM is currently vacuuming the indexes
vacuuming heap: VACUUM is currently vacuuming the heap
cleaning up indexes: VACUUM is currently cleaning up indexes
truncating heap: VACUUM is currently truncating the heap to return empty pages at the end of the relation to the operating system
performing final cleanup: VACUUM is performing final cleanup. During this phase, VACUUM will vacuum the free space map, update statistics in pg_class, and report statistics to the statistics collector
Reference taken from the official page: