Last active
November 8, 2019 17:42
-
-
Save victorpendleton/6ce495aec12776741f038690133965b7 to your computer and use it in GitHub Desktop.
Get Postgres Schema Table Sizes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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