PostgreSQL DBA(62) - PG 12 More progress reporting

PostgreSQL 12新增了pg_stat_progress_cluster,用以统计database的活动进度,加强了数据库的易用性.

PG11


[xdb@localhost testdb]$ psql -p 5433 -d testdb
psql (11.2)
Type "help" for help.
testdb=# select * FROM pg_stat_progress_cluster;
ERROR:  relation "pg_stat_progress_cluster" does not exist
LINE 1: select * FROM pg_stat_progress_cluster;
                      ^
testdb=#

PG 11没有该relation.

PG12


[pg12@localhost ~]$ psql -d testdb
psql (12beta1)
Type "help" for help.
testdb=# vacuum full;
VACUUM
testdb=# 
testdb=# drop table t_status;
;
vacuum full;DROP TABLE
testdb=# create table t_status(id int,c1 varchar(200),c2 varchar(200),c3 varchar(200));
CREATE TABLE
testdb=# 
testdb=# insert into t_status select x,'c1'||x,'c2'||x,'c3'||x from generate_series(1,1000000) as x;
INSERT 0 1000000
testdb=# 
testdb=# update t_status set c1 = lpad(c1,200,'*'),c2=lpad(c2,200,'*');
UPDATE 1000000
testdb=# 
testdb=# vacuum full;

查询pg_stat_progress_cluster监控


testdb=# select pid,datname,relid::regclass,command,phase,heap_blks_scanned,heap_tuples_scanned FROM pg_stat_progress_cluster;
  pid  | datname | relid |   command   |       phase       | heap_blks_scanned | heap_tuples_scanned 
-------+---------+-------+-------------+-------------------+-------------------+---------------------
 10805 | testdb  | t1    | VACUUM FULL | seq scanning heap |              2989 |              552780
(1 row)

参考资料
Postgres 12 highlight - More progress reporting

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/6906/viewspace-2651753/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/6906/viewspace-2651753/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值