Skip to content

Instantly share code, notes, and snippets.

@akramarev
Created March 18, 2022 19:42
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 akramarev/93bc2d3d7ab49229e25be671255b6b53 to your computer and use it in GitHub Desktop.
Save akramarev/93bc2d3d7ab49229e25be671255b6b53 to your computer and use it in GitHub Desktop.
[postgres table and index size]
SELECT
relname as table_name,
pg_size_pretty(pg_total_relation_size(relid)) As "Total Size",
pg_size_pretty(pg_indexes_size(relid)) as "Index Size",
pg_size_pretty(pg_relation_size(relid)) as "Actual 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