1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-11 20:28:21 +03:00

pgbench: Remove \setrandom.

You can now do the same thing via \set using the appropriate function,
either random(), random_gaussian(), or random_exponential(), depending
on the desired distribution.  This is not backward-compatible, but per
discussion, it's worth it to avoid having the old syntax hang around
forever.

Fabien Coelho, reviewed by Michael Paquier, and adjusted by me.
This commit is contained in:
Robert Haas
2016-03-29 12:08:49 -04:00
parent 7abc157165
commit ad9566470b
2 changed files with 2 additions and 233 deletions

View File

@ -836,60 +836,6 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
</listitem>
</varlistentry>
<varlistentry>
<term>
<literal>\setrandom <replaceable>varname</> <replaceable>min</> <replaceable>max</> [ uniform | { gaussian | exponential } <replaceable>parameter</> ]</literal>
</term>
<listitem>
<para>
Sets variable <replaceable>varname</> to a random integer value
between the limits <replaceable>min</> and <replaceable>max</> inclusive.
Each limit can be either an integer constant or a
<literal>:</><replaceable>variablename</> reference to a variable
having an integer value.
</para>
<para>
<itemizedlist>
<listitem>
<para>
<literal>\setrandom n 1 10</> or <literal>\setrandom n 1 10 uniform</>
is equivalent to <literal>\set n random(1, 10)</> and uses a uniform
distribution.
</para>
</listitem>
<listitem>
<para>
<literal>\setrandom n 1 10 exponential 3.0</> is equivalent to
<literal>\set n random_exponential(1, 10, 3.0)</> and uses an
exponential distribution.
</para>
</listitem>
<listitem>
<para>
<literal>\setrandom n 1 10 gaussian 2.0</> is equivalent to
<literal>\set n random_gaussian(1, 10, 2.0)</>, and uses a gaussian
distribution.
</para>
</listitem>
</itemizedlist>
See the documentation of these functions below for further information
about the precise shape of these distributions, depending on the value
of the parameter.
</para>
<para>
Example:
<programlisting>
\setrandom aid 1 :naccounts gaussian 5.0
</programlisting></para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<literal>\sleep <replaceable>number</> [ us | ms | s ]</literal>