Skip to content

Instantly share code, notes, and snippets.

@fljdin
Last active August 21, 2019 12:24
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 fljdin/1e3edf7d1ceecce3a5b048da9c9546d6 to your computer and use it in GitHub Desktop.
Save fljdin/1e3edf7d1ceecce3a5b048da9c9546d6 to your computer and use it in GitHub Desktop.
SELECT schemaname, relname, pg_size_pretty(pg_relation_size(relname::regclass)) relsize, last_vacuum, last_autovacuum, last_analyze, last_autoanalyze
FROM pg_stat_user_tables
WHERE greatest(last_autoanalyze,last_analyze) < now()-interval '5d'
AND pg_relation_size(relname::regclass) > 10e6;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment