Skip to content

Instantly share code, notes, and snippets.

@fedek6
Created April 10, 2017 11:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fedek6/f3dfa011f01c1addce38bb9ecd10dda2 to your computer and use it in GitHub Desktop.
Save fedek6/f3dfa011f01c1addce38bb9ecd10dda2 to your computer and use it in GitHub Desktop.
Get all PostgreSQL databases and their sizes
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