psql databases size code example Example: how to get the size of the database in postgresql SELECT pg_size_pretty( pg_database_size('dbname') );