PostgreSQL Database Object Size Functions

PG provides us several database object size functions to calculate the disk space usage of database objects. Such as:

  • pg_database_size()
  • pg_indexes_size()
  • pg_relation_size()
  • pg_table_size()
  • pg_total_relation_size()

The image below shows very clear about the definition of those functions. Thanks the answer from Satish Patro in this stack overflow question.

What’s the difference between pg_table_size, pg_relation_size & pg_total_relation_size? (PostgreSQL)

pg-size-functions.png