Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 547f04e

Browse files
committed
pgbench: Improve time logic.
Instead of instr_time (struct timespec) and the INSTR_XXX macros, introduce pg_time_usec_t and use integer arithmetic. Don't include the connection time in TPS unless using -C mode, but report it separately. Author: Fabien COELHO <coelho@cri.ensmp.fr> Reviewed-by: Kyotaro Horiguchi <horikyota.ntt@gmail.com> Reviewed-by: Hayato Kuroda <kuroda.hayato@fujitsu.com> Discussion: https://postgr.es/m/20200227180100.zyvjwzcpiokfsqm2%40alap3.anarazel.de
1 parent b1d6a8f commit 547f04e

File tree

4 files changed

+231
-244
lines changed

4 files changed

+231
-244
lines changed

doc/src/sgml/ref/pgbench.sgml

+20-19
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,10 @@ number of clients: 10
5858
number of threads: 1
5959
number of transactions per client: 1000
6060
number of transactions actually processed: 10000/10000
61-
tps = 85.184871 (including connections establishing)
62-
tps = 85.296346 (excluding connections establishing)
61+
latency average = 11.013 ms
62+
latency stddev = 7.351 ms
63+
initial connection time = 45.758 ms
64+
tps = 896.967014 (without initial connection time)
6365
</screen>
6466

6567
The first six lines report some of the most important parameter
@@ -68,8 +70,7 @@ tps = 85.296346 (excluding connections establishing)
6870
and number of transactions per client); these will be equal unless the run
6971
failed before completion. (In <option>-T</option> mode, only the actual
7072
number of transactions is printed.)
71-
The last two lines report the number of transactions per second,
72-
figured with and without counting the time to start database sessions.
73+
The last line reports the number of transactions per second.
7374
</para>
7475

7576
<para>
@@ -2257,22 +2258,22 @@ number of clients: 10
22572258
number of threads: 1
22582259
number of transactions per client: 1000
22592260
number of transactions actually processed: 10000/10000
2260-
latency average = 15.844 ms
2261-
latency stddev = 2.715 ms
2262-
tps = 618.764555 (including connections establishing)
2263-
tps = 622.977698 (excluding connections establishing)
2261+
latency average = 10.870 ms
2262+
latency stddev = 7.341 ms
2263+
initial connection time = 30.954 ms
2264+
tps = 907.949122 (without initial connection time)
22642265
statement latencies in milliseconds:
2265-
0.002 \set aid random(1, 100000 * :scale)
2266-
0.005 \set bid random(1, 1 * :scale)
2267-
0.002 \set tid random(1, 10 * :scale)
2268-
0.001 \set delta random(-5000, 5000)
2269-
0.326 BEGIN;
2270-
0.603 UPDATE pgbench_accounts SET abalance = abalance + :delta WHERE aid = :aid;
2271-
0.454 SELECT abalance FROM pgbench_accounts WHERE aid = :aid;
2272-
5.528 UPDATE pgbench_tellers SET tbalance = tbalance + :delta WHERE tid = :tid;
2273-
7.335 UPDATE pgbench_branches SET bbalance = bbalance + :delta WHERE bid = :bid;
2274-
0.371 INSERT INTO pgbench_history (tid, bid, aid, delta, mtime) VALUES (:tid, :bid, :aid, :delta, CURRENT_TIMESTAMP);
2275-
1.212 END;
2266+
0.001 \set aid random(1, 100000 * :scale)
2267+
0.001 \set bid random(1, 1 * :scale)
2268+
0.001 \set tid random(1, 10 * :scale)
2269+
0.000 \set delta random(-5000, 5000)
2270+
0.046 BEGIN;
2271+
0.151 UPDATE pgbench_accounts SET abalance = abalance + :delta WHERE aid = :aid;
2272+
0.107 SELECT abalance FROM pgbench_accounts WHERE aid = :aid;
2273+
4.241 UPDATE pgbench_tellers SET tbalance = tbalance + :delta WHERE tid = :tid;
2274+
5.245 UPDATE pgbench_branches SET bbalance = bbalance + :delta WHERE bid = :bid;
2275+
0.102 INSERT INTO pgbench_history (tid, bid, aid, delta, mtime) VALUES (:tid, :bid, :aid, :delta, CURRENT_TIMESTAMP);
2276+
0.974 END;
22762277
</screen>
22772278
</para>
22782279

0 commit comments

Comments
 (0)