pg_relation_size() is a system function for determining the on-disk size of a particular fork of a relation.
pg_relation_size() was added in PostgreSQL 8.1.
text] ) →
fork can be one of the following values (if not specified, defaults to main):
The caller does not require any permissions on the relation to determine its size. An ACCESS EXCLUSIVE LOCK on the table will however cause the function to stall until the lock is released.