How Big is My Database?

Here’s a nice snippet that can be used in a PostgreSQL database to output the current database’s size.

SELECT pg_size_pretty(pg_database_size(current_database())) AS human_size, 
       pg_database_size(current_database())                 AS raw_size;

That statement with output something along the lines of:

human_size  | raw_size
------------+--------------
181 GB      | 193841573064