Created
January 8, 2017 03:03
-
-
Save parasquid/769758276891e00c4798e76c0e118a27 to your computer and use it in GitHub Desktop.
Find out which records are taking up space
This file contains hidden or 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 | |
relname as "Table", | |
pg_size_pretty(pg_total_relation_size(relid)) As "Size", | |
pg_size_pretty(pg_total_relation_size(relid) - pg_relation_size(relid)) as "External Size" | |
FROM pg_catalog.pg_statio_user_tables ORDER BY pg_total_relation_size(relid) DESC; | |
SELECT schemaname,relname,n_live_tup | |
FROM pg_stat_user_tables | |
ORDER BY n_live_tup DESC; | |
https://wiki.postgresql.org/wiki/Disk_Usage |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment