Postgres tip of the day – show size of all databases
Here is a handy little query to show the size of all the databases on a particular postgres server:
SELECT pg_database.datname,
pg_size_pretty(pg_database_size(pg_database.datname)) AS size
FROM pg_database;
datname | size
--------------+---------
template1 | 6369 kB
template0 | 6361 kB
postgres | 6589 kB
foo | 55 MB
bar | 5129 MB
foobar | 85 GB
(6 rows)