server's port number
</para>
</listitem>
</varlistentry>
<varlistentry id="pgbench-option-username">
<term><option>-U</option> <replaceable>login</replaceable></term>
<term><option>--username=</option><replaceable>login</replaceable></term>
<listitem>
<para>
The user name to connect as
</para>
</listitem>
</varlistentry>
<varlistentry id="pgbench-option-version">
<term><option>-V</option></term>
<term><option>--version</option></term>
<listitem>
<para>
Print the <application>pgbench</application> version and exit.
</para>
</listitem>
</varlistentry>
<varlistentry id="pgbench-option-help">
<term><option>-?</option></term>
<term><option>--help</option></term>
<listitem>
<para>
Show help about <application>pgbench</application> command line
arguments, and exit.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect2>
</refsect1>
<refsect1>
<title>Exit Status</title>
<para>
A successful run will exit with status 0. Exit status 1 indicates static
problems such as invalid command-line options or internal errors which
are supposed to never occur. Early errors that occur when starting
benchmark such as initial connection failures also exit with status 1.
Errors during the run such as database errors or problems in the script
will result in exit status 2. In the latter case,
<application>pgbench</application> will print partial results if
<option>--exit-on-abort</option> option is not specified.
</para>
</refsect1>
<refsect1>
<title>Environment</title>
<variablelist>
<varlistentry id="pgbench-environment-pgdatabase">
<term><envar>PGDATABASE</envar></term>
<term><envar>PGHOST</envar></term>
<term><envar>PGPORT</envar></term>
<term><envar>PGUSER</envar></term>
<listitem>
<para>
Default connection parameters.
</para>
</listitem>
</varlistentry>
</variablelist>
<para>
This utility, like most other <productname>PostgreSQL</productname> utilities,
uses the environment variables supported by <application>libpq</application>
(see <xref linkend="libpq-envars"/>).
</para>
<para>
The environment variable <envar>PG_COLOR</envar> specifies whether to use
color in diagnostic messages. Possible values are
<literal>always</literal>, <literal>auto</literal> and
<literal>never</literal>.
</para>
</refsect1>
<refsect1>
<title>Notes</title>
<refsect2 id="transactions-and-scripts" xreflabel="What Is the "Transaction" Actually Performed in pgbench?">
<title>What Is the <quote>Transaction</quote> Actually Performed in <application>pgbench</application>?</title>
<para>
<application>pgbench</application> executes test scripts chosen randomly
from a specified list.
The scripts may include built-in scripts specified with <option>-b</option>
and user-provided scripts specified with <option>-f</option>.
Each script may be given a relative weight specified after an
<literal>@</literal> so as to change its selection probability.
The default weight is <literal>1</literal>.
Scripts with a weight of <literal>0</literal> are ignored.
</para>
<para>
The default built-in transaction script (also invoked with <option>-b tpcb-like</option>)
issues seven commands per transaction over randomly chosen <literal>aid</literal>,
<literal>tid</literal>, <literal>bid</literal> and <literal>delta</literal>.
The scenario is inspired by the TPC-B benchmark, but is not actually TPC-B,
hence the name.
</para>
<orderedlist>
<listitem><para><literal>BEGIN;</literal></para></listitem>
<listitem><para><literal>UPDATE pgbench_accounts SET abalance = abalance + :delta WHERE aid = :aid;</literal></para></listitem>
<listitem><para><literal>SELECT abalance FROM pgbench_accounts WHERE