Created
April 10, 2017 11:55
-
-
Save fedek6/f3dfa011f01c1addce38bb9ecd10dda2 to your computer and use it in GitHub Desktop.
Get all PostgreSQL databases and their sizes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
psql -c "SELECT pg_database.datname, pg_database_size(pg_database.datname), pg_size_pretty(pg_database_size(pg_database.datname)) FROM pg_database ORDER BY pg_database_size DESC;" -d <db_name> <db_user> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment