PostgreSQL 18 · Inspecting the database
Check a database's size
Show the on-disk size of a database in a readable unit.
SELECT pg_size_pretty(pg_database_size('mydb'));
Official PostgreSQL 18 documentation
More inspecting the database commands
All inspecting the database commands · PostgreSQL 18 cheatsheet