postgresqlvacuum
This is an old revision of the document!
Vacuuming
SELECT relname, n_live_tup, n_dead_tup, FLOOR(current_setting('autovacuum_vacuum_threshold')::INTEGER + (current_setting('autovacuum_vacuum_scale_factor')::NUMERIC * (n_live_tup))) AS "Autovacuum Threshold", round(n_dead_tup / FLOOR(current_setting('autovacuum_vacuum_threshold')::INTEGER + (current_setting('autovacuum_vacuum_scale_factor')::NUMERIC * (n_live_tup)))*100,2) AS "Percentage", last_vacuum, last_autovacuum FROM pg_stat_user_tables WHERE n_live_tup > 0 ORDER BY 5 DESC LIMIT 10;
postgresqlvacuum.1631996612.txt.gz · Last modified: 2025/03/08 22:23 (external edit)