pgstattuple (一)

作者:瀚高PG实验室 (Highgo PG Lab)- 海无涯
瀚高数据库需要先安装pgstattuple拓展模块:

CREATE EXTENSION
highgo=# \dx
                   List of installed extensions
    Name     | Version |   Schema   |         Description          
-------------+---------+------------+------------------------------
 highgo_x    | 9.5.7   | pg_catalog | Make it fly
 pgstattuple | 1.3     | public     | show tuple-level statistics
 plpgsql     | 1.0     | pg_catalog | PL/pgSQL procedural language
(3 rows)


highgo=# SELECT * FROM pgstattuple('pg_catalog.pg_proc');
 table_len | tuple_count | tuple_len | tuple_percent | dead_tuple_count | dead_tuple_len | dead_tuple_percent | free_space | free_percent 
-----------+-------------+-----------+---------------+------------------+----------------+--------------------+------------+--------------
    688128 |        3294 |    646866 |            94 |                0 |              0 |                  0 |      14692 |         2.14
(1 row)

highgo=# \x
Expanded display is on.
highgo=# SELECT * FROM pgstattuple('pg_catalog.pg_proc');
-[ RECORD 1 ]------+-------
table_len          | 688128
tuple_count        | 3294
tuple_len          | 646866
tuple_percent      | 94
dead_tuple_count   | 0
dead_tuple_len     | 0
dead_tuple_percent | 0
free_space         | 14692
free_percent       | 2.14

pgstattuple 输出列如下:

   Column	        Type	    Description
table_len	       bigint	  Physical relation length in bytes
tuple_count	       bigint	  Number of live tuples
tuple_len	       bigint	  Total length of live tuples in bytes
tuple_percent	   float8	  Percentage of live tuples
dead_tuple_count   bigint	  Number of dead tuples
dead_tuple_len	   bigint	  Total length of dead tuples in bytes
dead_tuple_percent float8	  Percentage of dead tuples
free_space	       bigint	  Total free space in bytes
free_percent	   float8	  Percentage of free space

    字段              类型            描述
table_len           bigint       物理关系长度,以字节计
tuple_count         bigint       活的元组的数量
tuple_len           bigint       活的元组的总长度,以字节计
tuple_percent       float8       活的元组的百分比
dead_tuple_count    bigint       死的元组的数量
dead_tuple_len      bigint       死的元组的总长度,以字节计
dead_tuple_percent  float8       死的元组的百分比
free_space          bigint       空闲空间总量,以字节计
free_percent        float8       空闲空间的百分比

Note: The table_len will always be greater than the sum of the tuple_len, dead_tuple_len and free_space. The difference is accounted for by fixed page overhead, the per-page table of pointers to tuples, and padding to ensure that tuples are correctly aligned.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值