重庆思庄Oracle、Redhat认证学习论坛
标题:
获取PG表每个字段大小
[打印本页]
作者:
郑全
时间:
2024-8-25 19:05
标题:
获取PG表每个字段大小
比如想看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)
欢迎光临 重庆思庄Oracle、Redhat认证学习论坛 (http://bbs.cqsztech.com/)
Powered by Discuz! X3.2