Skip to content

Commit 7bafffe

Browse files
committed
pgbench: Allow changing weights for scripts
Previously, all scripts had the same probability of being chosen when multiple of them were specified via -b, -f, -N, -S. With this commit, -b and -f now search for an "@" in the script name and use the integer found after it as the drawing probability for that script. (One disadvantage is that if you have script whose names contain @, you are now forced to specify "@1" at the end; otherwise the name's @ is confused with a weight separator. We don't expect many pgbench script with @ in their names in the wild, so this shouldn't be too serious a problem.) While at it, rework the interface between addScript, process_file, process_builtin, and findBuiltin. It had gotten a bit out of hand with recent commits. Author: Fabien Coelho Reviewed-By: Andres Freund, Robert Haas, Álvaro Herrera, Michaël Paquier Discussion: http://www.postgresql.org/message-id/alpine.DEB.2.10.1603160721240.1666@sto
1 parent b46d9be commit 7bafffe

File tree

2 files changed

+170
-87
lines changed

2 files changed

+170
-87
lines changed

doc/src/sgml/ref/pgbench.sgml

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -262,11 +262,13 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
262262

263263
<variablelist>
264264
<varlistentry>
265-
<term><option>-b</> <replaceable>scriptname</></term>
266-
<term><option>--builtin</> <replaceable>scriptname</></term>
265+
<term><option>-b</> <replaceable>scriptname[@weight]</></term>
266+
<term><option>--builtin</>=<replaceable>scriptname[@weight]</></term>
267267
<listitem>
268268
<para>
269269
Add the specified builtin script to the list of executed scripts.
270+
An optional integer weight after <literal>@</> allows to adjust the
271+
probability of drawing the script. If not specified, it is set to 1.
270272
Available builtin scripts are: <literal>tpcb-like</>,
271273
<literal>simple-update</> and <literal>select-only</>.
272274
Unambiguous prefixes of builtin names are accepted.
@@ -322,12 +324,14 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
322324
</varlistentry>
323325

324326
<varlistentry>
325-
<term><option>-f</> <replaceable>filename</></term>
326-
<term><option>--file=</><replaceable>filename</></term>
327+
<term><option>-f</> <replaceable>filename[@weight]</></term>
328+
<term><option>--file=</><replaceable>filename[@weight]</></term>
327329
<listitem>
328330
<para>
329331
Add a transaction script read from <replaceable>filename</> to
330332
the list of executed scripts.
333+
An optional integer weight after <literal>@</> allows to adjust the
334+
probability of drawing the test.
331335
See below for details.
332336
</para>
333337
</listitem>
@@ -687,9 +691,13 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
687691
<title>What is the <quote>Transaction</> Actually Performed in <application>pgbench</application>?</title>
688692

689693
<para>
690-
Pgbench executes test scripts chosen randomly from a specified list.
694+
<application>pgbench</> executes test scripts chosen randomly
695+
from a specified list.
691696
They include built-in scripts with <option>-b</> and
692697
user-provided custom scripts with <option>-f</>.
698+
Each script may be given a relative weight specified after a
699+
<literal>@</> so as to change its drawing probability.
700+
The default weight is <literal>1</>.
693701
</para>
694702

695703
<para>
@@ -1194,12 +1202,11 @@ number of clients: 10
11941202
number of threads: 1
11951203
number of transactions per client: 1000
11961204
number of transactions actually processed: 10000/10000
1205+
latency average = 15.844 ms
1206+
latency stddev = 2.715 ms
11971207
tps = 618.764555 (including connections establishing)
11981208
tps = 622.977698 (excluding connections establishing)
1199-
SQL script 1: &lt;builtin: TPC-B (sort of)&gt;
1200-
- 10000 transactions (100.0% of total, tps = 618.764555)
1201-
- latency average = 15.844 ms
1202-
- latency stddev = 2.715 ms
1209+
script statistics:
12031210
- statement latencies in milliseconds:
12041211
0.004386 \set nbranches 1 * :scale
12051212
0.001343 \set ntellers 10 * :scale

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy