SELECT
schema_table AS "schema.table",
pg_size_pretty(pg_relation_size(schema_table)) AS table_size,
pg_size_pretty(pg_indexes_size(schema_table)) AS index_size,
pg_size_pretty(pg_total_relation_size(schema_table)) AS total_size
FROM (
SELECT schemaname || '.' || tablename AS schema_table
FROM pg_catalog.pg_tables
WHERE schemaname NOT IN ('pg_catalog', 'information_schema', 'pg_toast')
) AS x
ORDER BY
pg_total_relation_size(schema_table) DESC;
SELECT
schema_table AS "schema.table",
pg_size_pretty(pg_relation_size(schema_table)) AS table_size,
pg_size_pretty(pg_indexes_size(schema_table)) AS index_size,
pg_size_pretty(pg_total_relation_size(schema_table)) AS total_size
FROM (
SELECT schemaname || '.' || tablename AS schema_table
FROM pg_catalog.pg_tables
WHERE schemaname NOT IN ('pg_catalog', 'information_schema', 'pg_toast')
) AS x
ORDER BY
pg_total_relation_size(schema_table) DESC;