Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit66581a8

Browse files
author
Marina Polyakova
committed
Pgbench Fix documentation (from Liudmila Mantrova)
1 parent0f97d91 commit66581a8

File tree

1 file changed

+93
-64
lines changed

1 file changed

+93
-64
lines changed

‎doc/src/sgml/ref/pgbench.sgml

Lines changed: 93 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,10 @@ tps = 85.296346 (excluding connections establishing)
6868
and number of transactions per client); these will be equal unless the run
6969
failed before completion. (In <option>-T</> mode, only the actual
7070
number of transactions is printed.)
71-
The next two lines report the number of
72-
transactions with serialization and deadlock failures; unlike other errors
73-
transactions with these ones don't fail and continue run normally, but
74-
transaction result is rolled back.
75-
And the last two lines report the number of transactions per second,
71+
The next two lines report the number of transactions with serialization and
72+
deadlock failures. With such errors, transactions do not fail and continue
73+
running normally, but the transaction result is rolled back.
74+
The last two lines report the number of transactions per second,
7675
figured with and without counting the time to start database sessions.
7776
</para>
7877

@@ -345,25 +344,24 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
345344
</varlistentry>
346345

347346
<varlistentry>
348-
<term><option>-I</option> <replaceable>isolationlevel</></term>
349-
<term><option>--default-isolation-level=</option><replaceable>isolationlevel</></term>
347+
<term><option>-I</option> <replaceable>isolation_level</></term>
348+
<term><option>--default-isolation-level=</option><replaceable>isolation_level</></term>
350349
<listitem>
351350
<para>
352-
Set default transaction isolation level. Use next abbreviations for
353-
<replaceable>isolationlevel</>:
351+
Set the default transaction isolation level:
354352
<itemizedlist>
355353
<listitem>
356-
<para><literal>RC</>:set default transaction isolation level asRead Committed.</para>
354+
<para><literal>RC</>: Read Committed</para>
357355
</listitem>
358356
<listitem>
359-
<para><literal>RR</>:set default transaction isolation level asRepeatable Read.</para>
357+
<para><literal>RR</>: Repeatable Read</para>
360358
</listitem>
361359
<listitem>
362-
<para><literal>S</>:set default transaction isolation level asSerializable.</para>
360+
<para><literal>S</>: Serializable</para>
363361
</listitem>
364362
</itemizedlist>
365-
The default isRead Committed isolation level.(See
366-
<xref linkend="transaction-iso"> for more information.)
363+
By default,Read Committed isolation level is used.For more
364+
information, see<xref linkend="transaction-iso">.
367365
</para>
368366
</listitem>
369367
</varlistentry>
@@ -465,13 +463,13 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
465463
<listitem>
466464
<para>
467465
Show progress report every <replaceable>sec</> seconds. The report
468-
includes the time since the beginning of the run andnext
469-
characteristics since the last report: the tps, the number of
470-
transactionswith serialization and deadlock failures, and the
471-
transaction latencyaverage and standard deviation. Under throttling
472-
(<option>-R</>), thelatency is computed with respect to the transaction
473-
scheduled starttime, not the actual transaction beginning time, thus it
474-
also includesthe average schedule lag time.
466+
includes the time since the beginning of the run andthe following
467+
statistics since the last report: the tps, the number of transactions
468+
with serialization and deadlock failures, and the transaction latency
469+
average and standard deviation. Under throttling (<option>-R</>), the
470+
latency is computed with respect to the transaction scheduled start
471+
time, not the actual transaction beginning time, thus it also includes
472+
the average schedule lag time.
475473
</para>
476474
</listitem>
477475
</varlistentry>
@@ -483,9 +481,11 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
483481
<para>
484482
Report the average per-statement latency (execution time from the
485483
perspective of the client) of each command after the benchmark
486-
finishes (with the number of serialization and deadlock failures for
487-
each command if it is used with <option>--report-failures</> option).
488-
See below for details.
484+
finishes. You can use this option together with the
485+
<option>--report-failures</> option to get the number of serialization
486+
and deadlock failures for each command.
487+
For details, see <xref linkend="per-statement-latencies-failures"
488+
endterm="per-statement-latencies-failures-title">.
489489
</para>
490490
</listitem>
491491
</varlistentry>
@@ -644,9 +644,11 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
644644
<listitem>
645645
<para>
646646
Report the number of serialization and deadlock failures for each
647-
command after the benchmark finishes (with the average per-statement
648-
latencies of each command if it is used with <option>-r</> option). See
649-
below for details.
647+
command after the benchmark finishes. You can use this option together
648+
with the <option>--report-latencies</> option to get the average
649+
per-statement latencies of each command.
650+
For details, see <xref linkend="per-statement-latencies-failures"
651+
endterm="per-statement-latencies-failures-title">.
650652
</para>
651653
</listitem>
652654
</varlistentry>
@@ -1218,14 +1220,19 @@ END;
12181220
When both <option>--rate</> and <option>--latency-limit</> are used,
12191221
the <replaceable>time</> for a skipped transaction will be reported as
12201222
<literal>skipped</>.
1221-
If transaction has serialization / deadlock failure or them both (last thing
1222-
is possible if used script contains several transactions; see
1223-
<xref linkend="transactions-and-scripts"
1224-
endterm="transactions-and-scripts-title"> for more information), its
1225-
<replaceable>time</> will be reported as <literal>serialization failure</> /
1226-
<literal>deadlock failure</> /
1227-
<literal>serialization and deadlock failures</> appropriately.
1223+
If a transaction has serialization and/or deadlock failures, its
1224+
<replaceable>time</> will be reported as <literal>serialization failure</>,
1225+
<literal>deadlock failure</>, or
1226+
<literal>serialization and deadlock failures</>, respectively.
12281227
</para>
1228+
<note>
1229+
<para>
1230+
Transactions can have both serialization and deadlock failures if the
1231+
used script contained several transactions. See
1232+
<xref linkend="transactions-and-scripts"
1233+
endterm="transactions-and-scripts-title"> for more information.
1234+
</para>
1235+
</note>
12291236

12301237
<para>
12311238
Here is a snippet of the log file generated:
@@ -1253,7 +1260,7 @@ END;
12531260
</para>
12541261

12551262
<para>
1256-
Example with serialization, deadlockandboth these failures:
1263+
Example with serializationanddeadlock failures:
12571264
<screen>
12581265
1 128 24968 0 1496759158 426984
12591266
0 129 serialization failure 0 1496759158 427023
@@ -1287,7 +1294,7 @@ END;
12871294
format time stamp), <replaceable>num_of_transactions</> is the number of transactions
12881295
within the interval, <replaceable>num_serialization_failures_transactions</>
12891296
and <replaceable>num_deadlock_failures_transactions</> are the numbers of
1290-
transactions withappropriate failures within the interval, <replaceable>
1297+
transactions withthe corresponding failures within the interval, <replaceable>
12911298
latency_sum</replaceable> is a sum of latencies (so you can compute average
12921299
latency easily). The following two fields are useful for variance estimation
12931300
- <replaceable>latency_sum</> is a sum of latencies and <replaceable>
@@ -1322,27 +1329,42 @@ END;
13221329

13231330
</refsect2>
13241331

1325-
<refsect2>
1326-
<title>Per-Statement Latencies and Failures</title>
1332+
<refsect2 id="per-statement-latencies-failures">
1333+
<title id="per-statement-latencies-failures-title">Per-Statement Latencies and Failures</title>
13271334

13281335
<para>
1329-
There're two options to get some per-statement characteristics: <option>-r</>
1330-
and <option>--report-failures</> (they can be combined together). All values
1331-
are computed for each statement executed by every client and are reported
1332-
after the benchmark has finished. With the <option>-r</> option,
1333-
<application>pgbench</> collects the elapsed transaction time of each
1334-
statement. It then reports an average of those values, referred to as the
1335-
latency for each statement. With the <option>--report-failures</> option,
1336-
<application>pgbench</> collects the number of serialization and deadlock
1337-
failures for each statement (notice that the total sum of per-command
1338-
failures of each type can be greater than the number of "transactions" with
1339-
these failures; see <xref linkend="transactions-and-scripts"
1340-
endterm="transactions-and-scripts-title"> for more information).
1336+
To get per-statement statistics, you can use the following options:
1337+
<itemizedlist>
1338+
<listitem>
1339+
<para>
1340+
<option>--report-latencies</> &mdash; collects the elapsed transaction
1341+
time of each statement and reports an average of those values, referred
1342+
to as the latency for each statement.
1343+
</para>
1344+
</listitem>
1345+
<listitem>
1346+
<para>
1347+
<option>--report-failures</> &mdash; collects the number of
1348+
serialization and deadlock failures for each statement.
1349+
</para>
1350+
<note>
1351+
<para>The total sum of per-command failures of each type can be greater
1352+
than the number of transactions with reported failures.
1353+
See <xref linkend="transactions-and-scripts"
1354+
endterm="transactions-and-scripts-title"> for more information.
1355+
</para>
1356+
</note>
1357+
</listitem>
1358+
</itemizedlist>
1359+
All values are computed for each statement executed by every client and are
1360+
reported after the benchmark has finished. You can use
1361+
<option>--report-latencies</> and <option>--report-failures</> options
1362+
together to get a full report.
13411363
</para>
13421364

13431365
<para>
1344-
For the default script if you use <option>-r</> option, the output will look
1345-
similar to this:
1366+
For the default script, if you usethe<option>-r</> option, the output will
1367+
looksimilar to this:
13461368
<screen>
13471369
starting vacuum...end.
13481370
transaction type: &lt;builtin: TPC-B (sort of)&gt;
@@ -1377,7 +1399,8 @@ script statistics:
13771399
</screen>
13781400

13791401
Another example of output for the default script using serializable default
1380-
transaction isolation level (-I S) and <option>--report-failures</> option:
1402+
transaction isolation level (<option>-I S</option>) and
1403+
<option>--report-failures</> option:
13811404
<screen>
13821405
starting vacuum...end.
13831406
transaction type: &lt;builtin: TPC-B (sort of)&gt;
@@ -1397,17 +1420,23 @@ script statistics:
13971420
- number of transactions with serialization failures: 9284 (92.840%)
13981421
- number of transactions with deadlock failures: 0 (0.000%)
13991422
- statement serialization and deadlock failures:
1400-
0 0 \set aid random(1, 100000 * :scale)
1401-
0 0 \set bid random(1, 1 * :scale)
1402-
0 0 \set tid random(1, 10 * :scale)
1403-
0 0 \set delta random(-5000, 5000)
1404-
0 0 BEGIN;
1405-
0 0 UPDATE pgbench_accounts SET abalance = abalance + :delta WHERE aid = :aid;
1406-
0 0 SELECT abalance FROM pgbench_accounts WHERE aid = :aid;
1407-
7975 0 UPDATE pgbench_tellers SET tbalance = tbalance + :delta WHERE tid = :tid;
1408-
1305 0 UPDATE pgbench_branches SET bbalance = bbalance + :delta WHERE bid = :bid;
1409-
0 0 INSERT INTO pgbench_history (tid, bid, aid, delta, mtime) VALUES (:tid, :bid, :aid, :delta, CURRENT_TIMESTAMP);
1410-
4 0 END;
1423+
0 0 \set aid random(1, 100000 * :scale)
1424+
0 0 \set bid random(1, 1 * :scale)
1425+
0 0 \set tid random(1, 10 * :scale)
1426+
0 0 \set delta random(-5000, 5000)
1427+
0 0 BEGIN;
1428+
0 0 UPDATE pgbench_accounts
1429+
SET abalance = abalance + :delta WHERE aid = :aid;
1430+
0 0 SELECT abalance FROM pgbench_accounts
1431+
WHERE aid = :aid;
1432+
7975 0 UPDATE pgbench_tellers
1433+
SET tbalance = tbalance + :delta WHERE tid = :tid;
1434+
1305 0 UPDATE pgbench_branches
1435+
SET bbalance = bbalance + :delta WHERE bid = :bid;
1436+
0 0 INSERT INTO pgbench_history
1437+
(tid, bid, aid, delta, mtime)
1438+
VALUES (:tid, :bid, :aid, :delta, CURRENT_TIMESTAMP);
1439+
4 0 END;
14111440
</screen>
14121441
</para>
14131442

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp