Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Get Postgres Schema Table Sizes
SELECT n.nspname
, c.relname
, ROUND(SUM(pg_total_relation_size(c.oid))/1024/1024, 2) AS MB
FROM pg_class c INNER
JOIN pg_namespace n
ON c.relnamespace = n.oid
WHERE relkind = 'r'
AND n.nspname IN ('')
GROUP BY 1, 2
ORDER BY 3;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.