Created
May 3, 2016 22:23
-
-
Save rcanepa/ccd19def00d4844f7c74a4606ce9b467 to your computer and use it in GitHub Desktop.
PostgreSQL database and tables sizes
This file contains hidden or 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
------------------ | |
From psql | |
------------------ | |
- Check all database sizes | |
\l+ | |
- Connect to database DBNAME | |
\connect DBNAME | |
- Check the table sizes from database DBNAME | |
\d+ | |
------------------ | |
As a SQL statement | |
------------------ | |
- Database Size | |
SELECT pg_size_pretty(pg_database_size('Database Name')); | |
- Table Size | |
SELECT pg_size_pretty(pg_relation_size('table_name')); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment