Cloud

pg_relation_size

The pg_relation_size() function returns the size of a relation in bytes. In Redpanda SQL, pg_relation_size(), pg_table_size(), and pg_total_relation_size() return the same value.

Syntax

pg_relation_size('relation_name')
pg_relation_size(relation_oid)

Parameters

  • relation_name: Name of the relation to determine the size for. Type: text.

  • relation_oid: Object identifier (OID) of the relation. The type can be integer or bigint.

Return type

bigint.

Examples

Get the size of the orders table in bytes:

SELECT pg_relation_size('orders');