Created
May 20, 2014 06:46
-
-
Save drob/4923ab4ab569c9770aee to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
nspname, | |
relname, | |
dead_tuples, | |
autovacuum_threshold, | |
dead_tuples > autovacuum_threshold AS overdue | |
FROM ( | |
SELECT | |
nspname, | |
relname, | |
pg_stat_get_dead_tuples(pg_class.oid) AS dead_tuples, | |
round(current_setting('autovacuum_vacuum_threshold')::INTEGER | |
+ current_setting('autovacuum_vacuum_scale_factor')::NUMERIC * reltuples) AS autovacuum_threshold | |
FROM pg_class, pg_namespace | |
WHERE pg_class.relnamespace = pg_namespace.oid | |
) t | |
ORDER BY overdue DESC; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment