首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >PostgreSQL扩展统计

PostgreSQL扩展统计
EN

Database Administration用户
提问于 2021-01-16 16:06:43
回答 1查看 183关注 0票数 0

我有一个1TB只读数据库,在这里性能是至关重要的。由于查询是由用户动态生成的,因此很难预测它们(整个过程基本上是一个可视化平台,位于大量的医学研究集合之上,用户选择他们想要可视化的内容)。查询通常很复杂,涉及到10+联接。我最近了解了扩展的统计特性,但是我在网上发现很少关于什么时候最好使用它的信息(除了文档中的内容)。

DB是相当好的规范化,但是广泛使用了非规范化的物化视图。在为所有成对列创建扩展统计信息(依赖项和顶n)时是否存在性能损失或其他问题?它将产生大约70个表格的500项统计数字。分析或插入的时间与此无关,只是阅读性能。另外,是否有一个工具或代码片段来帮助我这样做?

我使用Postgresql 12,它尽可能地优化了w.r.t。索引。

EN

回答 1

Database Administration用户

发布于 2021-02-09 00:23:02

我认为你最好的办法是设置一个方法来监控相关表和索引计数器的统计数据:

https://www.postgresql.org/docs/current/monitoring-stats.html#MONITORING-PG-STAT-ALL-TABLES-VIEW

特别是:

代码语言:javascript
复制
   seq_scan bigint

   Number of sequential scans initiated on this table

   seq_tup_read bigint

   Number of live rows fetched by sequential scans

   iseq_scan bigint

   Number of sequential scans initiated on this table

   seq_tup_read bigint

   Number of live rows fetched by sequential scans

   idx_scan bigint

   Number of index scans initiated on this table

   idx_tup_fetch bigint

   Number of live rows fetched by index scansdx_scan bigint

   Number of index scans initiated on this table

   idx_tup_fetch bigint

   Number of live rows fetched by index scans

https://www.postgresql.org/docs/current/monitoring-stats.html#MONITORING-PG-STAT-ALL-INDEXES-VIEW

代码语言:javascript
复制
idx_scan bigint

Number of index scans initiated on this index

idx_tup_read bigint

Number of index entries returned by scans on this index

idx_tup_fetch bigint

Number of live table rows fetched by simple index scans using this index
票数 0
EN
页面原文内容由Database Administration提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://dba.stackexchange.com/questions/283387

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档