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) or by using the phpPgAdmin web interface (for databases only).
You can use the psql command-line program to determine the sizes of PostgreSQL databases and tables. To do this, follow these steps:
psql dbname username
To determine the size of a database, type the following command. Replace dbname with the name of the database that you want to check:
SELECT pg_size_pretty( pg_database_size('dbname') );
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:
SELECT pg_size_pretty( pg_total_relation_size('tablename') );
Psql displays the size of the table.
You can use the phpPgAdmin web interface to determine the sizes of PostgreSQL databases. To determine the sizes of PostgreSQL tables, however, you must use the psql command-line program as described in the previous section.
To determine the size of a PostgreSQL database using phpPgAdmin, follow these steps:
The phpPgAdmin administration page appears in a new window.
In the left pane, click PostgreSQL:
phpPgAdmin displays the size of each database:
Subscribe to receive weekly cutting edge tips, strategies, and news you need to grow your web business.
No charge. Unsubscribe anytime.
Did you find this article helpful? Then you'll love our support. Experience the A2 Hosting difference today and get a pre-secured, pre-optimized website. Check out our web hosting plans today.
We use cookies to personalize the website for you and to analyze the use of our website. You consent to this by clicking on "I consent" or by continuing your use of this website. Further information about cookies can be found in our Privacy Policy.