Skip to content

Instantly share code, notes, and snippets.

@rahul100885
Created July 2, 2014 12:09
Show Gist options
  • Save rahul100885/a222b5085b6896d22f19 to your computer and use it in GitHub Desktop.
Save rahul100885/a222b5085b6896d22f19 to your computer and use it in GitHub Desktop.
Find largest size table ( Disk usage )
SELECT relname, PG_SIZE_PRETTY(PG_TOTAL_RELATION_SIZE(relid)) FROM pg_stat_all_tables WHERE schemaname != 'pg_toast' AND relname LIKE 'pg_%' ORDER BY PG_TOTAL_RELATION_SIZE(relid) DESC;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment