比如想看T1表每个字段占的空间:
postgres=# \d t1
Table "public.t1"
Column | Type | Collation | Nullable | Default
--------+-------------------+-----------+----------+---------
id | integer | | |
name | character varying | | |
id1 | smallint | | |
id2 | bigint | | |
id3 | numeric(5,2) | | |
postgres=# select pg_column_size(id),pg_column_size(id1),pg_column_size(id2),pg_column_size(id3) from t1;
pg_column_size | pg_column_size | pg_column_size | pg_column_size
----------------+----------------+----------------+----------------
4 | 2 | 8 | 7
(7 rows)
|