PostgreSQL 10.0 preview 功能增强 - QUERY进度显示

标签

PostgreSQL , 10.0 , query进度


背景

query进度的显示,有一个插件pg_query_state支持。

PostgreSQL 10.0将在内核层面增加一个这样的支持。

首先会在analye命令上尝试,但是它会设计为通用的视图,支持其他命令,诸如CREATE INDEX, VAUUM, CLUSTER等。

Hello Hackers,  

Following is a proposal for reporting the progress of ANALYZE command:  

It seems that the following could be the phases of ANALYZE processing:  
1. Collecting sample rows  
2. Collecting inherited sample rows  
3. Computing heap stats  
4. Computing index stats  
5. Cleaning up indexes  

The first phase is easy if there is no inheritance but in case of   
inheritance we need to sample the blocks from multiple heaps.  
Here the progress is counted against total number of blocks processed.  

The view provides the information of analyze command progress details as   
follows  
postgres=# \d pg_stat_progress_analyze  
           View "pg_catalog.pg_stat_progress_analyze"  
       Column       |  Type   | Collation | Nullable | Default  
-------------------+---------+-----------+----------+---------  
  pid               | integer |           |          |  
  datid             | oid     |           |          |  
  datname           | name    |           |          |  
  relid             | oid     |           |          |  
  phase             | text    |           |          |  
  heap_blks_total   | bigint  |           |          |  
  heap_blks_scanned | bigint  |           |          |  
  total_sample_rows | bigint  |           |          |  

I feel this view information may be useful in checking the progress of   
long running ANALYZE command.  


The attached patch reports the different phases of analyze command.  
Added this patch to CF 2017-03.  

Opinions?  

Note: Collecting inherited sample rows phase is not reported yet in the   
patch.  

Regards,  
Vinayak Pokale  
NTT Open Source Software Center  

这个patch的讨论,详见邮件组,本文末尾URL。

PostgreSQL社区的作风非常严谨,一个patch可能在邮件组中讨论几个月甚至几年,根据大家的意见反复的修正,patch合并到master已经非常成熟,所以PostgreSQL的稳定性也是远近闻名的。

参考

《官人要杯咖啡吗? - PostgreSQL实时监测PLAN tree的执行进度 - pg_query_state》

https://commitfest.postgresql.org/13/1053/

https://www.postgresql.org/message-id/flat/c1691d3a-5b8f-ba1a-105a-3d3ef33f36ce@lab.ntt.co.jp#c1691d3a-5b8f-ba1a-105a-3d3ef33f36ce@lab.ntt.co.jp

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值