postgres datbase size from commandline code example Example: postgres get size of database SELECT pg_size_pretty( pg_database_size('dbname') );