How to find the size of PostgreSQL databases and tables
This article demonstrates how to determine the size of PostgreSQL databases and tables. You can do this by using the psql command-line program (for databases and tables).
USING THE COMMAND LINE
You can use the psql command-line program to determine the sizes of PostgreSQL databases and tables. To do this, follow these steps:
Log in to your account using SSH.
At the command line, type the following command. Replace dbname with the name of the database, and username with the database username:
At the Password prompt, type the database user's password. When you type the correct password, the psql prompt appears.
To determine the size of a database, type the following command. Replace dbnamewith the name of the database that you want to check:
Psql displays the size of the database.
To determine the size of a table in the current database, type the following command. Replace tablename with the name of the table that you want to check:
Psql displays the size of the table.