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

本文涉及的产品
RDS PostgreSQL Serverless,0.5-4RCU 50GB 3个月
推荐场景:
对影评进行热评分析
RDS SQL Server Serverless,2-4RCU 50GB 3个月
推荐场景:
云原生数据库 PolarDB 分布式版,标准版 2核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数据库、数据库生态工具、云原生智能化数据库管控平台,为阿里巴巴经济体以及各个行业的企业客户和开发者提供从公共云到混合云再到私有云的完整解决方案,提供基于云基础设施进行数据从处理、到存储、再到计算与分析的一体化解决方案。本节课带你了解阿里云数据库产品家族及特性。
目录
相关文章
|
12天前
|
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 确保列值唯一。
|
6月前
|
监控 关系型数据库 数据库
PostgreSQL的索引优化策略?
【8月更文挑战第26天】PostgreSQL的索引优化策略?
146 1
|
6月前
|
缓存 运维 监控
PostgreSQL运维技巧之vacuum调优
PostgreSQL运维技巧之vacuum调优
551 3
|
6月前
|
SQL 关系型数据库 MySQL
SQL Server、MySQL、PostgreSQL:主流数据库SQL语法异同比较——深入探讨数据类型、分页查询、表创建与数据插入、函数和索引等关键语法差异,为跨数据库开发提供实用指导
【8月更文挑战第31天】SQL Server、MySQL和PostgreSQL是当今最流行的关系型数据库管理系统,均使用SQL作为查询语言,但在语法和功能实现上存在差异。本文将比较它们在数据类型、分页查询、创建和插入数据以及函数和索引等方面的异同,帮助开发者更好地理解和使用这些数据库。尽管它们共用SQL语言,但每个系统都有独特的语法规则,了解这些差异有助于提升开发效率和项目成功率。
675 0
|
6月前
|
关系型数据库 数据库 PostgreSQL
PostgreSQL索引维护看完这篇就够了
PostgreSQL索引维护看完这篇就够了
437 0
|
9月前
|
SQL 关系型数据库 数据库
RDS PostgreSQL索引推荐原理及最佳实践
前言很多开发人员都知道索引对于数据库的查询性能至关重要,一个好的索引能使数据库的性能提升成千上万倍。但给数据库加索引是一项相对专业的工作,需要对数据库的运行原理有一定了解。同时,加了索引有没有性能提升、性能提升了多少,这些都是加索引前就想知道的。这项繁杂的工作有没有更好的方案呢?有!就是今天重磅推出...
149 1
RDS PostgreSQL索引推荐原理及最佳实践
|
关系型数据库 分布式数据库 PolarDB
《阿里云产品手册2022-2023 版》——PolarDB for PostgreSQL
《阿里云产品手册2022-2023 版》——PolarDB for PostgreSQL
388 0
|
存储 缓存 关系型数据库
|
存储 SQL 并行计算
PolarDB for PostgreSQL 开源必读手册-开源PolarDB for PostgreSQL架构介绍(中)
PolarDB for PostgreSQL 开源必读手册-开源PolarDB for PostgreSQL架构介绍
458 0
|
存储 算法 安全
PolarDB for PostgreSQL 开源必读手册-开源PolarDB for PostgreSQL架构介绍(下)
PolarDB for PostgreSQL 开源必读手册-开源PolarDB for PostgreSQL架构介绍
406 0

相关产品

  • 云原生数据库 PolarDB
  • 云数据库 RDS PostgreSQL 版