=== Grösse der DB ===
SELECT pg_size_pretty(pg_database_size(''));
=== Platzbedarf der Tabellen ===
select tablename, pg_size_pretty(s) from (select tablename, pg_relation_size(tablename::text) s
from pg_tables where tableowner = '') as ss order by s desc;
=== Platzbedarf der Indizes ===
select indexname, tablename, pg_size_pretty(s) from
(select tablename, indexname,pg_relation_size(indexname::text) s from pg_indexes)
as ss order by s desc;
=== Verhältnis Tables zu indices ===
select pg_size_pretty(sumind) "space index",
pg_size_pretty(sumtable) "space table",
round(sumind/sumtable, 3) "quotient" from
(select sum(pg_relation_size(indexname::text)) sumind from pg_indexes) ti,
(select sum(pg_relation_size(tablename::text)) sumtable from pg_tables where tableowner = '') tt;