# SELECT pg_relation_size(20306, 'main') AS main, pg_relation_size(20306, 'fsm') AS fsm, pg_relation_size(20306, 'vm') AS vm, pg_relation_size(20306, 'init') AS init, pg_table_size(20306), pg_indexes_size(20306) AS indexes, pg_total_relation_size(20306) AS total; main | fsm | vm | init | pg_table_size | indexes | total --------+-------+------+------+---------------+---------+-------- 253952 | 24576 | 8192 | 0 | 286720 | 196608 | 483328 (1 ROW) |
由此可见,pg_table_size是pg_relation_size所有返回值的总和。 而pg_total_relation_size是pg_table_size和pg_indexes_size的总和。
如果您想知道表正在使用多少空间,请使用pg_table_size和pg_total_relation_size考虑它们-一个数字是仅表的,一个数字是表+索引的。
检查存储文件的布局,以获取有关fsm,vm和init的含义以及它们在磁盘上的存储方式的一些信息。
标签:20306,relation,pg,table,total,size From: https://www.cnblogs.com/lovezhr/p/17622508.html