Skip to content

Instantly share code, notes, and snippets.

@jlaffaye
Created January 12, 2016 18:22
Show Gist options
  • Save jlaffaye/42d8267214f71bd19e90 to your computer and use it in GitHub Desktop.
Save jlaffaye/42d8267214f71bd19e90 to your computer and use it in GitHub Desktop.
PostgreSQL Table Size
SELECT
relname as "Table",
pg_size_pretty(pg_total_relation_size(relid)) As "Size",
pg_size_pretty(pg_total_relation_size(relid) - pg_relation_size(relid)) as "External Size"
FROM pg_catalog.pg_statio_user_tables 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