pg_column_size()

A system function for showing the size of data in a table column

pg_column_size() is a system function for showing the size of data in a table column.

pg_column_size() was added in PostgreSQL 8.1.

Usage

pg_column_size ( "any" ) → integer

Change history

Examples

postgres=# CREATE TABLE foo (id INT, val TEXT);
CREATE TABLE

postgres=# INSERT INTO foo VALUES(1,'abc'), (2,'Hello World');
INSERT 0 2

postgres=# SELECT id, pg_column_size(id), val, pg_column_size(val) FROM foo;
 id | pg_column_size |     val     | pg_column_size 
----+----------------+-------------+----------------
  1 |              4 | abc         |              4
  2 |              4 | Hello World |             12
(2 rows)

Categories

Management / adminstration, System function

See also

pg_column_compression(), pg_table_size(), pg_indexes_size(), pg_total_relation_size(), pg_tablespace_size(), pg_database_size()