PostgreSQL 10.0 preview sharding增强 - 支持异步, 多节点并行

本文涉及的产品
RDS MySQL Serverless 基础系列,0.5-2RCU 50GB
RDS SQL Server Serverless,2-4RCU 50GB 3个月
推荐场景:
云数据库 RDS MySQL,集群系列 2核4GB
推荐场景:
搭建个人博客
简介:

标签

PostgreSQL , 10.0 , sharding 增强


背景

PostgreSQL 10.0的sharding增强,比如聚合函数的下推算一个。

现在又带来了一个核武器级别的增强,postgres_fdw的异步化调用。

为什么说是核武器级别的呢,比如你有16个sharding节点(对应postgres_fdw的16个库),10.0以前,如果我需要执行一个QUERY涉及到所有的sharding节点时,每个sharding节点是串行执行的然后append结果。

10.0开始,会变成异步化执行,也就是可以并行执行,然后append结果再往下个NODE走。

这样效率会大大提高。

+Asynchronous Execution  
+----------------------  
+  
+In certain cases, it's desirable for a node to indicate that it cannot  
+return any tuple immediately but may be able to do at a later time.  This  
+might either because the node is waiting on an event external to the  
+database system, such as a ForeignScan awaiting network I/O, or because  
+the node is waiting for an event internal to the database system - e.g.  
+one process involved in a parallel query may find that it cannot progress  
+a certain parallel operation until some other process reaches a certain  
+point in the computation.  A process which discovers this type of situation  
+can always handle it simply by blocking, but this may waste time that could  
+be spent executing some other part of the plan where progress could be  
+made immediately.  This is particularly likely to occur when the plan  
+contains an Append node.  
+  
+To use asynchronous execution, a node must first request a tuple from an  
+async-capable child node using ExecAsyncRequest.  Next, it must execute  
+the asynchronous event loop using ExecAsyncEventLoop; it can avoid giving  
+up control indefinitely by passing a timeout to this function, even passing  
+-1 to poll for events without blocking.  Eventually, when a node to which an  
+asynchronous request has been made produces a tuple, the requesting node  
+will receive a callback from the event loop via ExecAsyncResponse. Typically,  
+the ExecAsyncResponse callback is the only one required for nodes that wish  
+to request tuples asynchronously.  
+  
+On the other hand, nodes that wish to produce tuples asynchronously  
+generally need to implement three methods:  
+  
+1. When an asynchronous request is made, the node's ExecAsyncRequest callback  
+will be invoked; it should use ExecAsyncSetRequiredEvents to indicate the  
+number of file descriptor events for which it wishes to wait and whether it  
+wishes to receive a callback when the process latch is set. Alternatively,  
+it can instead use ExecAsyncRequestDone if a result is available immediately.  
+  
+2. When the event loop wishes to wait or poll for file descriptor events and  
+the process latch, the ExecAsyncConfigureWait callback is invoked to configure  
+the file descriptor wait events for which the node wishes to wait.  This  
+callback isn't needed if the node only cares about the process latch.  
+  
+3. When file descriptors or the process latch become ready, the node's  
+ExecAsyncNotify callback is invoked.  

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

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

参考

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

https://www.postgresql.org/message-id/flat/CA+TgmoaXQEt4tZ03FtQhnzeDEMzBck+Lrni0UWHVVgOTnA6C1w@mail.gmail.com#CA+TgmoaXQEt4tZ03FtQhnzeDEMzBck+Lrni0UWHVVgOTnA6C1w@mail.gmail.com

相关实践学习
使用PolarDB和ECS搭建门户网站
本场景主要介绍基于PolarDB和ECS实现搭建门户网站。
阿里云数据库产品家族及特性
阿里云智能数据库产品团队一直致力于不断健全产品体系,提升产品性能,打磨产品功能,从而帮助客户实现更加极致的弹性能力、具备更强的扩展能力、并利用云设施进一步降低企业成本。以云原生+分布式为核心技术抓手,打造以自研的在线事务型(OLTP)数据库Polar DB和在线分析型(OLAP)数据库Analytic DB为代表的新一代企业级云原生数据库产品体系, 结合NoSQL数据库、数据库生态工具、云原生智能化数据库管控平台,为阿里巴巴经济体以及各个行业的企业客户和开发者提供从公共云到混合云再到私有云的完整解决方案,提供基于云基础设施进行数据从处理、到存储、再到计算与分析的一体化解决方案。本节课带你了解阿里云数据库产品家族及特性。
目录
相关文章
|
消息中间件 存储 关系型数据库
PostgreSQL技术大讲堂 - 第33讲:并行查询管理
PostgreSQL从小白到专家,技术大讲堂 - 第33讲:并行查询管理
495 1
|
9月前
|
关系型数据库 MySQL 分布式数据库
PolarDB MySQL版并行查询技术探索与实践
PolarDB MySQL版并行查询技术探索与实践 PolarDB MySQL版在企业级查询加速特性上进行了深度技术探索,其中并行查询作为其重要组成部分,已经在线稳定运行多年,持续演进。本文将详细介绍并行查询的背景、挑战、方案、特性以及实践。
277 2
|
9月前
|
SQL 关系型数据库 MySQL
实时计算 Flink版产品使用合集之支持 MySQL 的并行复制吗
实时计算Flink版作为一种强大的流处理和批处理统一的计算框架,广泛应用于各种需要实时数据处理和分析的场景。实时计算Flink版通常结合SQL接口、DataStream API、以及与上下游数据源和存储系统的丰富连接器,提供了一套全面的解决方案,以应对各种实时计算需求。其低延迟、高吞吐、容错性强的特点,使其成为众多企业和组织实时数据处理首选的技术平台。以下是实时计算Flink版的一些典型使用合集。
|
8月前
|
存储 缓存 关系型数据库
心得经验总结:理解MySQL——并行数据库与分区(Partion)
心得经验总结:理解MySQL——并行数据库与分区(Partion)
65 0
|
关系型数据库 大数据 PostgreSQL
PostgreSQL16-新特性-并行聚合
PostgreSQL16-新特性-并行聚合
161 0
|
SQL 关系型数据库 MySQL
Flink CDC 现在支持mysql 的并行复制吗?
Flink CDC 现在支持mysql 的并行复制吗?
142 1
|
关系型数据库 MySQL
MySQL 5.7 基于GTID主从复制+并行复制+半同步复制
MySQL 5.7 基于GTID主从复制+并行复制+半同步复制
216 0
|
存储 SQL Oracle
AnalyticDB PostgreSQL 7.0 支持存储过程(CREATE PROCEDURE)特性
AnalyticDB PostgreSQL 7.0 新增了存储过程功能的支持,让用户在使用ADB PG时能够更方便高效地开发业务,并能够更好地兼容Oracle等传统数仓的业务。
528 1
AnalyticDB PostgreSQL 7.0 支持存储过程(CREATE PROCEDURE)特性
|
SQL 存储 关系型数据库
PostgreSQL 流复制搭建主从环境,同步和异步的解释,压力测试,主从角色切换|学习笔记
快速学习PostgreSQL 流复制搭建主从环境,同步和异步的解释,压力测试,主从角色切换
PostgreSQL 流复制搭建主从环境,同步和异步的解释,压力测试,主从角色切换|学习笔记
|
存储 SQL Oracle
10 PostgreSQL 表级复制-物化视图篇, 支持异地,异构如 Oracle 到 pg 的物化视图|学习笔记
快速学习10 PostgreSQL 表级复制-物化视图篇,支持异地,异构如 Oracle 到 pg 的物化视图
10 PostgreSQL 表级复制-物化视图篇, 支持异地,异构如 Oracle 到 pg 的物化视图|学习笔记

相关产品

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