Skip to content

Latest commit

 

History

History
86 lines (54 loc) · 4.28 KB

20240125_02.md

File metadata and controls

86 lines (54 loc) · 4.28 KB

PostgreSQL 17 preview - pgbench工具新增meta语法syncpipeline, pgbench: Add \syncpipeline

作者

digoal

日期

2024-01-25

标签

PostgreSQL , PolarDB , DuckDB , pipeline , pgbench , syncpipeline


背景

pipeline mode是PG 14引入的libpq SQL请求异步通信模式, 在client -to- PG serverRT较差的网络环境中, 通过异步和批量请求减少交互次数, 可以实现大幅度提升SQL处理吞吐.

In pipeline mode, statements are sent to the server without waiting for the results of previous statements.

pgbench可以用于压测pipeline模式, 同时PG 17引入syncpipeline meta语法, 支持不中断pipeline的情况下flush pipe buffer. 模拟真实场景.

pgbench: Add \syncpipeline  
author	Michael Paquier <michael@paquier.xyz>	  
Wed, 24 Jan 2024 07:55:19 +0000 (16:55 +0900)  
committer	Michael Paquier <michael@paquier.xyz>	  
Wed, 24 Jan 2024 07:55:19 +0000 (16:55 +0900)  
commit	94edfe250c6a200d2067b0debfe00b4122e9b11e  
tree	a5b77c29dccee9b6ccc14e448f5802d8f4601d67	tree  
parent	faa2b953ba3be0fac9af614ac14e34cf3a0a2c46	commit | diff  
pgbench: Add \syncpipeline  
  
This change adds a new meta-command called \syncpipeline to pgbench,  
able to send a sync message without flushing using the new libpq  
function PQsendPipelineSync().  
  
This meta-command is available within a block made of \startpipeline and  
\endpipeline.  
  
Author: Anthonin Bonnefoy  
Discussion: https://postgr.es/m/CAO6_XqpcNhW6LZHLF-2NpPzdTbyMm4-RVkr3+AP5cOKSm9hrWA@mail.gmail.com  
     <term><literal>\startpipeline</literal></term>  
+    <term><literal>\syncpipeline</literal></term>  
     <term><literal>\endpipeline</literal></term>  
  
  
+        This group of commands implements pipelining of SQL statements.  
+        A pipeline must begin with a <command>\startpipeline</command>  
+        and end with an <command>\endpipeline</command>. In between there  
+        may be any number of <command>\syncpipeline</command> commands,  
+        which sends a <link linkend="protocol-flow-ext-query">sync message</link>  
+        without ending the ongoing pipeline and flushing the send buffer.  
+        In pipeline mode, statements are sent to the server without waiting  
+        for the results of previous statements.    

digoal's wechat