1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-31 22:04:40 +03:00

Add libpq pipeline mode support to pgbench

New metacommands \startpipeline and \endpipeline allow the user to run
queries in libpq pipeline mode.

Author: Daniel Vérité <daniel@manitou-mail.org>
Reviewed-by: Álvaro Herrera <alvherre@alvh.no-ip.org>
Discussion: https://postgr.es/m/b4e34135-2bd9-4b8a-94ca-27d760da26d7@manitou-mail.org
This commit is contained in:
Alvaro Herrera
2021-03-15 18:33:03 -03:00
parent acb7e4eb6b
commit 9aa491abbf
3 changed files with 216 additions and 16 deletions

View File

@ -1110,6 +1110,12 @@ pgbench <optional> <replaceable>options</replaceable> </optional> <replaceable>d
row, the last value is kept.
</para>
<para>
<literal>\gset</literal> and <literal>\aset</literal> cannot be used in
pipeline mode, since the query results are not yet available by the time
the commands would need them.
</para>
<para>
The following example puts the final account balance from the first query
into variable <replaceable>abalance</replaceable>, and fills variables
@ -1270,6 +1276,22 @@ SELECT 4 AS four \; SELECT 5 AS five \aset
</programlisting></para>
</listitem>
</varlistentry>
<varlistentry id='pgbench-metacommand-pipeline'>
<term><literal>\startpipeline</literal></term>
<term><literal>\endpipeline</literal></term>
<listitem>
<para>
These commands delimit the start and end of a pipeline of SQL
statements. In pipeline mode, statements are sent to the server
without waiting for the results of previous statements. See
<xref linkend="libpq-pipeline-mode"/> for more details.
Pipeline mode requires the use of extended query protocol.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect2>