Skip to content

Instantly share code, notes, and snippets.

@v0rts
Last active November 16, 2020 17:29
Show Gist options
  • Save v0rts/a79c24c08023b412bbf001e394ee0e73 to your computer and use it in GitHub Desktop.
Save v0rts/a79c24c08023b412bbf001e394ee0e73 to your computer and use it in GitHub Desktop.
SELECT relname, n_live_tup, n_dead_tup, trunc(100*n_dead_tup/(n_live_tup+1))::float "ratio%",
to_char(last_autovacuum, 'YYYY-MM-DD HH24:MI:SS') as autovacuum_date,
to_char(last_autoanalyze, 'YYYY-MM-DD HH24:MI:SS') as autoanalyze_date
FROM pg_stat_all_tables
ORDER BY last_autovacuum;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment