Skip to content

Instantly share code, notes, and snippets.

@rgolangh
Last active December 8, 2016 20:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rgolangh/049cff30b89c5b29284ceee80a35dbb4 to your computer and use it in GitHub Desktop.
Save rgolangh/049cff30b89c5b29284ceee80a35dbb4 to your computer and use it in GitHub Desktop.
Report postgres user tables stats order by dead rows count
SELECT
relname,
n_tup_upd,
n_tup_del,
n_tup_hot_upd,
n_dead_tup,
last_vacuum,
last_autovacuum,
last_analyze,
last_autoanalyze,
vacuum_count,
autovacuum_count,
autoanalyze_count
FROM pg_stat_user_tables
ORDER BY n_dead_tup
DESC;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment