1CopySELECT pg_database.datname as "database_name", pg_database_size(pg_database.datname)/1024/1024 AS size_in_mb FROM pg_database ORDER by size_in_mb DESC;
2
1/* For multiple databases */
2select t1.datname AS db_name,
3 pg_size_pretty(pg_database_size(t1.datname)) as db_size
4from pg_database t1
5order by pg_database_size(t1.datname) desc;
6