Created
March 18, 2011 08:17
-
-
Save nmandery/875769 to your computer and use it in GitHub Desktop.
views to get relations sizes in postgresql
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
create or replace view public.size_schemata as | |
select table_schema, | |
pg_size_pretty(sum(pg_total_relation_size(table_schema || '."' || table_name || '"')::bigint)::bigint) As fulltblsize, | |
pg_size_pretty(sum(pg_relation_size(table_schema || '."' || table_name || '"')::bigint)::bigint) As justthetblsize | |
from information_schema.tables | |
where table_catalog = current_database() | |
group by table_schema |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment