Monday, 18 June 2018

How much disk space does a PostgreSQL database, table or index use?


The amount of disk space used by a PostgreSQL database, table or index can be obtained by querying the PostgreSQL data dictionary.

Database size

The query


will return the current database size in bytes.

To view the size in K, MB or GB you can run the query:


Table of Index size

Tables and Indexes are referred to as relations in PostgreSQL. Run the following query to view the size of a relation in bytes:


To view the size in K, MB or GB you can run the query:








No comments:

Post a Comment