/ Startseite / Blog / Technologisch

Querying PostgreSQL Schema Sizes

select table_schema, pg_size_pretty(sum(pg_relation_size(table_schema || '.' || table_name)))
from information_schema.tables
where table_schema in ('public', '_timescaledb_internal') and table_type = 'BASE TABLE'
group by table_schema 
order by 2 desc

Posted in Technologisch on Jun 15, 2022