Hello everyone,
Some novices may find it useful:
How to calculate disk space occupied by each of top 10 biggest tables:
SELECT relpages * 8192 AS size_in_bytes, relname FROM pg_class WHERE
relnamespace = (SELECT oid FROM pg_namespace WHERE nspname = 'public')
ORDER BY size_in_bytes DESC LIMIT 10;
How to calculate total disk space occupied by all tables:
SELECT SUM(sizes.size_in_bytes) FROM (SELECT relpages * 8192 AS
size_in_bytes, relname FROM pg_class WHERE relnamespace = (SELECT oid
FROM pg_namespace WHERE nspname = 'public')) AS sizes;
I have two questions:
1. Is it possible to do the equivalent calculations with indexes? If so,
how?
2. Is it possible to display both top 10 tables and the total size of
Regards,
Marcin Krol