Database size
select pg_size_pretty( pg_database_size('dbname') );
Tables order by size
select
table_name,
pg_size_pretty(pg_total_relation_size(quote_ident(table_name))),
pg_total_relation_size(quote_ident(table_name))
from information_schema.tables
where table_schema = 'public'
order by 3 desc;
References:
https://stackoverflow.com/questions/21738408/postgresql-list-and-order-tables-by-size
No comments:
Post a Comment