PostgreSQL – Get table size

pg_relation_size() function can be used to obtain the size of a table in bytes in Postgres database. Below is the syntax where ‘table_name’ is the name of the table for which you would like to find the size.

SELECT pg_relation_size('table_name'); 
See also  PostgreSQL - Escape single quote