PostgreSQL 10.0 preview 多核并行增强 - 索引扫描、子查询、VACUUM、fdw/csp钩子

本文涉及的产品
RDS MySQL DuckDB 分析主实例,基础系列 4核8GB
RDS AI 助手,专业版
RDS MySQL DuckDB 分析主实例,集群系列 4核8GB
简介:

标签

PostgreSQL , 10.0 , 并行计算 , 索引扫描 , 子查询 , VACUUM , 外部表并行


背景

PostgreSQL 9.6推出的多核并行计算特性,支持全表扫描,hash join,聚合操作。

10.0 在此基础上,增加了更多的支持。

1. Parallel bitmap heap scan

2. Parallel Index Scans

3. Parallel Merge Join

4. parallelize queries containing subplans

5. Block level parallel vacuum

6. Extending the parallelism for index-only scans

7. ParallelFinish Hook of FDW/CSP

这是一个fdw钩子,用于在访问FDW/CSP的node(backend process)的内存上下文释放前,让上面的gather node获得上下文的控制权。

从而,从DSM中获得每个fdw node通道的统计信息,比如pg_strom项目,custom scan阶段的dma数据传输的速度,GPU的运算时间等。

使用这个钩子,就可以达到以上目的。

Hello,  
  
The attached patch implements the suggestion by Amit before.  
  
What I'm motivated is to collect extra run-time statistics specific  
to a particular ForeignScan/CustomScan, not only the standard  
Instrumentation; like DMA transfer rate or execution time of GPU  
kernels in my case.  
  
Per-node DSM toc is one of the best way to return run-time statistics  
to the master backend, because FDW/CSP can assign arbitrary length of  
the region according to its needs. It is quite easy to require.  
However, one problem is, the per-node DSM toc is already released when  
ExecEndNode() is called on the child node of Gather.  
  
This patch allows extensions to get control on the master backend's  
context when all the worker node gets finished but prior to release  
of the DSM segment. If FDW/CSP has its special statistics on the  
segment, it can move to the private memory area for EXPLAIN output  
or something other purpose.  
  
One design consideration is whether the hook shall be called from  
ExecParallelRetrieveInstrumentation() or ExecParallelFinish().  
The former is a function to retrieve the standard Instrumentation  
information, thus, it is valid only if EXPLAIN ANALYZE.  
On the other hands, if we put entrypoint at ExecParallelFinish(),  
extension can get control regardless of EXPLAIN ANALYZE, however,  
it also needs an extra planstate_tree_walker().  
  
Right now, we don't assume anything onto the requirement by FDW/CSP.  
It may want run-time statistics regardless of EXPLAIN ANALYZE, thus,  
hook shall be invoked always when Gather node confirmed termination  
of the worker processes.  
  
Thanks,  
--  
NEC OSS Promotion Center / PG-Strom Project  
KaiGai Kohei <kaigai(at)ak(dot)jp(dot)nec(dot)com>  

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

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

参考

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

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

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

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

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

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

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

相关实践学习
使用PolarDB和ECS搭建门户网站
本场景主要介绍如何基于PolarDB和ECS实现搭建门户网站。
阿里云数据库产品家族及特性
阿里云智能数据库产品团队一直致力于不断健全产品体系,提升产品性能,打磨产品功能,从而帮助客户实现更加极致的弹性能力、具备更强的扩展能力、并利用云设施进一步降低企业成本。以云原生+分布式为核心技术抓手,打造以自研的在线事务型(OLTP)数据库Polar DB和在线分析型(OLAP)数据库Analytic DB为代表的新一代企业级云原生数据库产品体系, 结合NoSQL数据库、数据库生态工具、云原生智能化数据库管控平台,为阿里巴巴经济体以及各个行业的企业客户和开发者提供从公共云到混合云再到私有云的完整解决方案,提供基于云基础设施进行数据从处理、到存储、再到计算与分析的一体化解决方案。本节课带你了解阿里云数据库产品家族及特性。
目录
相关文章
|
消息中间件 存储 关系型数据库
PostgreSQL技术大讲堂 - 第33讲:并行查询管理
PostgreSQL从小白到专家,技术大讲堂 - 第33讲:并行查询管理
832 1
|
10月前
|
存储 监控 关系型数据库
B-tree不是万能药:PostgreSQL索引失效的7种高频场景与破解方案
在PostgreSQL优化实践中,B-tree索引虽承担了80%以上的查询加速任务,但因多种原因可能导致索引失效,引发性能骤降。本文深入剖析7种高频失效场景,包括隐式类型转换、函数包裹列、前导通配符等,并通过实战案例揭示问题本质,提供生产验证的解决方案。同时,总结索引使用决策矩阵与关键原则,助你让索引真正发挥作用。
604 0
|
监控 关系型数据库 数据库
PostgreSQL的索引优化策略?
【8月更文挑战第26天】PostgreSQL的索引优化策略?
599 1
|
SQL 关系型数据库 OLAP
云原生数据仓库AnalyticDB PostgreSQL同一个SQL可以实现向量索引、全文索引GIN、普通索引BTREE混合查询,简化业务实现逻辑、提升查询性能
本文档介绍了如何在AnalyticDB for PostgreSQL中创建表、向量索引及混合检索的实现步骤。主要内容包括:创建`articles`表并设置向量存储格式,创建ANN向量索引,为表增加`username`和`time`列,建立BTREE索引和GIN全文检索索引,并展示了查询结果。参考文档提供了详细的SQL语句和配置说明。
522 2
|
JSON 关系型数据库 PostgreSQL
PostgreSQL 9种索引的原理和应用场景
PostgreSQL 支持九种主要索引类型,包括 B-Tree、Hash、GiST、SP-GiST、GIN、BRIN、Bitmap、Partial 和 Unique 索引。每种索引适用于不同场景,如 B-Tree 适合范围查询和排序,Hash 仅用于等值查询,GiST 支持全文搜索和几何数据查询,GIN 适用于多值列和 JSON 数据,BRIN 适合非常大的表,Bitmap 适用于低基数列,Partial 只对部分数据创建索引,Unique 确保列值唯一。
1321 15
|
SQL 关系型数据库 MySQL
SQL Server、MySQL、PostgreSQL:主流数据库SQL语法异同比较——深入探讨数据类型、分页查询、表创建与数据插入、函数和索引等关键语法差异,为跨数据库开发提供实用指导
【8月更文挑战第31天】SQL Server、MySQL和PostgreSQL是当今最流行的关系型数据库管理系统,均使用SQL作为查询语言,但在语法和功能实现上存在差异。本文将比较它们在数据类型、分页查询、创建和插入数据以及函数和索引等方面的异同,帮助开发者更好地理解和使用这些数据库。尽管它们共用SQL语言,但每个系统都有独特的语法规则,了解这些差异有助于提升开发效率和项目成功率。
2057 0
|
关系型数据库 数据库 PostgreSQL
PostgreSQL索引维护看完这篇就够了
PostgreSQL索引维护看完这篇就够了
1427 0
|
SQL 关系型数据库 数据库
RDS PostgreSQL索引推荐原理及最佳实践
前言很多开发人员都知道索引对于数据库的查询性能至关重要,一个好的索引能使数据库的性能提升成千上万倍。但给数据库加索引是一项相对专业的工作,需要对数据库的运行原理有一定了解。同时,加了索引有没有性能提升、性能提升了多少,这些都是加索引前就想知道的。这项繁杂的工作有没有更好的方案呢?有!就是今天重磅推出...
613 1
RDS PostgreSQL索引推荐原理及最佳实践
|
关系型数据库 Go 数据库
《提高查询速度:PostgreSQL索引实用指南》
《提高查询速度:PostgreSQL索引实用指南》
817 0
|
关系型数据库 分布式数据库 数据库
PolarDB for PostgreSQL 14:全局索引
PolarDB for PostgreSQL 14 相较于 PostgreSQL 14,提供了更多企业级数据库的特性。本实验将体验其中的全局索引功能。

相关产品

  • 云原生数据库 PolarDB
  • 云数据库 RDS PostgreSQL 版
  • 推荐镜像

    更多