PostgreSQL – Get database size

Run the below query to get the size of a Postgres database, where ‘your_database_name’ is the name of the database that you would like to check the size for.

SELECT pg_size_pretty(pg_database_size('your_database_name'));

pg_size_pretty converts the size from bytes into an easily readable format.

See also  PostgreSQL - List installed extensions