Postgres Show Table Size on Disk

Created 2021-08-13 Modified 2022-10-24

The following commands allow you to query the size on disk occupied by tables, dbs and other relations. 

Table size 

SELECT pg_size_pretty( pg_total_relation_size('table_name') );

db size

SELECT pg_size_pretty( pg_database_size('dbname') );