Home Explore Blog CI



postgresql

19th chunk of `doc/src/sgml/ref/pgbench.sgml`
19a913b18eeda3d871a5ae4046b222472da450b7186c7fcc0000000100000fa0
 <replaceable>argument</replaceable>(s).
      The command must return an integer value through its standard output.
     </para>

     <para>
      <replaceable>command</replaceable> and each <replaceable>argument</replaceable> can be either
      a text constant or a <literal>:</literal><replaceable>variablename</replaceable> reference
      to a variable. If you want to use an <replaceable>argument</replaceable> starting
      with a colon, write an additional colon at the beginning of
      <replaceable>argument</replaceable>.
     </para>

     <para>
      Example:
<programlisting>
\setshell variable_to_be_assigned command literal_argument :variable ::literal_starting_with_colon
</programlisting></para>
    </listitem>
   </varlistentry>

   <varlistentry id="pgbench-metacommand-shell">
    <term>
     <literal>\shell <replaceable>command</replaceable> [ <replaceable>argument</replaceable> ... ]</literal>
    </term>

    <listitem>
     <para>
      Same as <literal>\setshell</literal>, but the result of the command
      is discarded.
     </para>

     <para>
      Example:
<programlisting>
\shell command literal_argument :variable ::literal_starting_with_colon
</programlisting></para>
    </listitem>
   </varlistentry>

   <varlistentry id="pgbench-metacommand-pipeline">
    <term><literal>\startpipeline</literal></term>
    <term><literal>\syncpipeline</literal></term>
    <term><literal>\endpipeline</literal></term>

    <listitem>
      <para>
        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.  See
        <xref linkend="libpq-pipeline-mode"/> for more details.
        Pipeline mode requires the use of extended query protocol.
     </para>
    </listitem>
   </varlistentry>

  </variablelist>
 </refsect2>

 <refsect2 id="pgbench-builtin-operators">
  <title>Built-in Operators</title>

  <para>
   The arithmetic, bitwise, comparison and logical operators listed in
   <xref linkend="pgbench-operators"/> are built into <application>pgbench</application>
   and may be used in expressions appearing in
   <link linkend="pgbench-metacommand-set"><literal>\set</literal></link>.
   The operators are listed in increasing precedence order.
   Except as noted, operators taking two numeric inputs will produce
   a double value if either input is double, otherwise they produce
   an integer result.
  </para>

   <table id="pgbench-operators">
    <title>pgbench Operators</title>
    <tgroup cols="1">
     <thead>
      <row>
       <entry role="func_table_entry"><para role="func_signature">
        Operator
       </para>
       <para>
        Description
       </para>
       <para>
        Example(s)
       </para></entry>
      </row>
     </thead>

     <tbody>
      <row>
       <entry role="func_table_entry"><para role="func_signature">
        <replaceable>boolean</replaceable> <literal>OR</literal> <replaceable>boolean</replaceable>
        <returnvalue><replaceable>boolean</replaceable></returnvalue>
       </para>
       <para>
        Logical OR
       </para>
       <para>
        <literal>5 or 0</literal>
        <returnvalue>TRUE</returnvalue>
       </para></entry>
      </row>

      <row>
       <entry role="func_table_entry"><para role="func_signature">
        <replaceable>boolean</replaceable> <literal>AND</literal> <replaceable>boolean</replaceable>
        <returnvalue><replaceable>boolean</replaceable></returnvalue>
       </para>
       <para>
        Logical AND
       </para>
       <para>
    

Title: pgbench Meta Commands: \shell, \startpipeline, \syncpipeline, \endpipeline and Built-in Operators
Summary
This section describes the pgbench meta command '\shell' which executes a shell command and discards its output. It introduces commands for pipelining of SQL statements such as '\startpipeline', '\syncpipeline', and '\endpipeline', allowing statements to be sent to the server without waiting for results. The section also outlines built-in arithmetic, bitwise, comparison, and logical operators available for use within pgbench expressions.