Is there any command to find all the databases size in Postgres?
I am able to find the size of a specific database by using following command:
select pg_database_size('databaseName');
Is there any command to find all the databases size in Postgres? I am able to find the size of a specific database by using following command:
|
||||
|
You can get the names of all the databases that you can connect to from the "pg_datbase" system table. Just apply the function to the names, as below.
If you intend the output to be consumed by a machine instead of a human, you can cut the pg_size_pretty() function. |
|||||||||
|
And... If in case you may not want to type a whole query... you can also type...
and you will get some details about the database, including the size of the database. And... To get sizes of all databases. you can just type...
You may need to go into the postgresql command prompt to query with these postgresql helper commands. Check other postgresql helper commands by typing
at the postgresql command prompt. |
|||||||||||||
|
|
|||||
|
Based on the answer here by @Hendy Irawan Show database sizes:
e.g.
Show table sizes:
e.g.
Only works in |
|||
|
From the PostgreSQL wiki. Databases to which the user cannot connect are sorted as if they were infinite size.
The page also has snippets for finding the size of your biggest relations and largest tables. |
|||
|
Start pgAdmin, connect to the server, click on the database name, and select the statistics tab. You will see the size of the database at the bottom of the list. Then if you click on another database, it stays on the statistics tab so you can easily see many database sizes without much effort. If you open the table list, it shows all tables and their sizes. |
|||||
|