Created
May 16, 2018 13:18
-
-
Save mgurov/ccc87c3dbd2c2db88b59860b016bd9f2 to your computer and use it in GitHub Desktop.
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 | |
nspname || '.' || relname as "relation", | |
pg_size_pretty( | |
pg_relation_size(C.oid) | |
) as "size", | |
to_char(round( pg_relation_size(C.oid) /( | |
select | |
sum( pg_relation_size( C.oid ) ) as "totalsize" | |
from | |
pg_class C | |
) * 100.0, 2), '90.00' ) percentage | |
from | |
pg_class C left join pg_namespace N on | |
( | |
N.oid = C.relnamespace | |
) | |
where | |
nspname not in( | |
'pg_catalog', | |
'information_schema' | |
) | |
and pg_relation_size(C.oid) > 100000 | |
order by | |
pg_relation_size(C.oid) desc limit 50; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment