command to check db size in postgres code example Example: how to get the size of the database in postgresql SELECT pg_size_pretty( pg_database_size('dbname') );