Skip to content

Instantly share code, notes, and snippets.

@JoshuaGross
Last active January 5, 2016 23:46
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 JoshuaGross/6d7f74946e32b6710e70 to your computer and use it in GitHub Desktop.
Save JoshuaGross/6d7f74946e32b6710e70 to your computer and use it in GitHub Desktop.
Size of all relations (indices, tables, etc) in a Postgres DB.
SELECT
relname AS objectname,
relkind AS objecttype,
reltuples AS "#entries",
pg_size_pretty(relpages::bigint*8*1024) AS size
FROM pg_class
WHERE relpages >= 8
ORDER BY relpages DESC;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment