This article is half-done without your Comment! *** Please share your thoughts via Comment ***
In this post, I am sharing a script for checking the status of AutoVacuum for all the PostgreSQL Tables.
If you don’t know about the MVCC architecture, you must visit the below article. Because of MVCC, we have to work on dead tuples which are generated by transactions in PostgreSQL.
You can configure auto-vacuum on tables, but periodically you should check the status of it. Use below script for checking the status of Autovacuum.
1 2 3 4 5 6 7 8 9 10 11 12 |
SELECT schemaname ,relname ,n_live_tup ,n_dead_tup ,last_autovacuum FROM pg_stat_all_tables ORDER BY n_dead_tup /(n_live_tup * current_setting('autovacuum_vacuum_scale_factor')::float8 + current_setting('autovacuum_vacuum_threshold')::float8) DESC |