3/27/15

How to Check Database and Table Size in PostgreSQL

This tutorial will help you to determine database size and table size in PostgreSQL server.
First login to your server using command line and connect to PostgreSQL server. Now you can use following commands to determine sizes of databases and tables in PostgreSQL.

1. Check Database Size in PostgreSQL

To determine database size execute following command from PostgreSQL command prompt.
postgres=# SELECT pg_size_pretty(pg_database_size('mydb'));

2. Check Table Size in PostgreSQL

To determine table size first connect to your database then execute following command fromPostgreSQL command prompt.
postgres=# \connect mydb;

mydb=# SELECT pg_size_pretty( pg_total_relation_size('mytbl'));

0 comments:

Post a Comment

FIND US ON FACEBOOK

FIND US ON Twitter