pg_relation_size()

A function for determining the size of a relation's fork

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.

Usage

pg_relation_size ( relation regclass [, fork text ] ) → bigint

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.

Note that for most purposes it will be more convenient to use one of pg_total_relation_size() or pg_table_size().

Change history

Categories

System function

See also

pg_total_relation_size(), pg_table_size(), pg_indexes_size()