Home Explore Blog CI



postgresql

24th chunk of `doc/src/sgml/ref/pgbench.sgml`
5ef7c09b33561e996182dd360e092665568709149ab41e7b0000000100000faa
 role="func_signature">
        <function>debug</function> ( <replaceable>number</replaceable> )
        <returnvalue></returnvalue> same type as input
       </para>
       <para>
        Prints the argument to <systemitem>stderr</systemitem>,
        and returns the argument.
       </para>
       <para>
        <literal>debug(5432.1)</literal>
        <returnvalue>5432.1</returnvalue>
       </para></entry>
      </row>

      <row>
       <entry role="func_table_entry"><para role="func_signature">
        <function>double</function> ( <replaceable>number</replaceable> )
        <returnvalue>double</returnvalue>
       </para>
       <para>
        Casts to double.
       </para>
       <para>
        <literal>double(5432)</literal>
        <returnvalue>5432.0</returnvalue>
       </para></entry>
      </row>

      <row>
       <entry role="func_table_entry"><para role="func_signature">
        <function>exp</function> ( <replaceable>number</replaceable> )
        <returnvalue>double</returnvalue>
       </para>
       <para>
        Exponential (<literal>e</literal> raised to the given power)
       </para>
       <para>
        <literal>exp(1.0)</literal>
        <returnvalue>2.718281828459045</returnvalue>
       </para></entry>
      </row>

      <row>
       <entry role="func_table_entry"><para role="func_signature">
        <function>greatest</function> ( <replaceable>number</replaceable> <optional>, <literal>...</literal> </optional> )
        <returnvalue></returnvalue> <type>double</type> if any argument is double, else <type>integer</type>
       </para>
       <para>
        Selects the largest value among the arguments.
       </para>
       <para>
        <literal>greatest(5, 4, 3, 2)</literal>
        <returnvalue>5</returnvalue>
       </para></entry>
      </row>

      <row>
       <entry role="func_table_entry"><para role="func_signature">
        <function>hash</function> ( <parameter>value</parameter> <optional>, <parameter>seed</parameter> </optional> )
        <returnvalue>integer</returnvalue>
       </para>
       <para>
        This is an alias for <function>hash_murmur2</function>.
       </para>
       <para>
        <literal>hash(10, 5432)</literal>
        <returnvalue>-5817877081768721676</returnvalue>
       </para></entry>
      </row>

      <row>
       <entry role="func_table_entry"><para role="func_signature">
        <function>hash_fnv1a</function> ( <parameter>value</parameter> <optional>, <parameter>seed</parameter> </optional> )
        <returnvalue>integer</returnvalue>
       </para>
       <para>
        Computes <ulink url="https://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function">FNV-1a hash</ulink>.
       </para>
       <para>
        <literal>hash_fnv1a(10, 5432)</literal>
        <returnvalue>-7793829335365542153</returnvalue>
       </para></entry>
      </row>

      <row>
       <entry role="func_table_entry"><para role="func_signature">
        <function>hash_murmur2</function> ( <parameter>value</parameter> <optional>, <parameter>seed</parameter> </optional> )
        <returnvalue>integer</returnvalue>
       </para>
       <para>
        Computes <ulink url="https://en.wikipedia.org/wiki/MurmurHash">MurmurHash2 hash</ulink>.
       </para>
       <para>
        <literal>hash_murmur2(10, 5432)</literal>
        <returnvalue>-5817877081768721676</returnvalue>
       </para></entry>
      </row>

      <row>
       <entry role="func_table_entry"><para role="func_signature">
        <function>int</function> ( <replaceable>number</replaceable> )
        <returnvalue>integer</returnvalue>
       </para>
       <para>
        Casts to integer.
       </para>
       <para>
        <literal>int(5.4 + 3.8)</literal>
        <returnvalue>9</returnvalue>
       </para></entry>
      </row>

      <row>
       <entry role="func_table_entry"><para role="func_signature">
        <function>least</function> ( <replaceable>number</replaceable> <optional>, <literal>...</literal>

Title: pgbench Built-In Functions (Part 1)
Summary
This section describes the built-in functions available in pgbench, which can be used within \set commands. It details functions such as `debug` (prints argument to stderr), `double` (casts to double), `exp` (exponential), `greatest` (selects largest value), `hash` (alias for hash_murmur2), `hash_fnv1a` (FNV-1a hash), `hash_murmur2` (MurmurHash2 hash) and `int` (casts to integer) with examples.