Created
June 8, 2018 14:05
-
-
Save mrchrisadams/531fc7440fc0a27343366d0d19da033d to your computer and use it in GitHub Desktop.
How big are all the tables in the 'public' schema in postgres
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
WITH disk_tables AS | |
(SELECT nspname, | |
relname, | |
pg_relation_size(c.oid) AS "size" | |
FROM pg_class c | |
LEFT JOIN pg_namespace n ON (n.oid = c.relnamespace) | |
WHERE nspname IN ('public')) | |
SELECT pg_size_pretty(SUM(disk_tables.size)) FROM disk_tables; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment