digoal
2024-01-25
PostgreSQL , PolarDB , DuckDB , pipeline , pgbench , syncpipeline
pipeline mode是PG 14引入的libpq SQL请求异步通信模式, 在client -to- PG server
RT较差的网络环境中, 通过异步和批量请求减少交互次数, 可以实现大幅度提升SQL处理吞吐.
In pipeline mode, statements are sent to the server without waiting for the results of previous statements.
- 《PostgreSQL 15 preview - pgbench pipeline压测代码优化, 提升性能》
- 《PostgreSQL 15 preview - libpq协议新增H消息, 通知DB server flush output buffer in pipeline mode.》
- 《PostgreSQL 14 preview - libpq驱动 支持pipeline 模式, SQL请求支持异步化通信, 大幅度提升性能, 降低RT》
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.