1select schemaname as table_schema,
2 relname as table_name,
3 pg_size_pretty(pg_total_relation_size(relid)) as total_size,
4 pg_size_pretty(pg_relation_size(relid)) as data_size,
5 pg_size_pretty(pg_total_relation_size(relid) - pg_relation_size(relid))
6 as external_size
7from pg_catalog.pg_statio_user_tables
8order by pg_total_relation_size(relid) desc,
9 pg_relation_size(relid) desc
10limit 10;
11