pgbench stats per script & other stuff

Fabien COELHO <coelho@cri.ensmp.fr>

From: Fabien <coelho@cri.ensmp.fr>
To: PostgreSQL Developers <pgsql-hackers@postgresql.org>
Date: 2015-07-17T13:50:06Z
Lists: pgsql-hackers

Attachments

This patch adds per-script statistics & other improvements to pgbench

Rationale: Josh asked for the per-script stats:-)

Some restructuring is done so that all stats (-l --aggregate-interval 
--progress --per-script-stats, latency & lag...) share the same structures 
and functions to accumulate data. This limits a lot the growth of pgbench 
from this patch (+17 lines).

In passing, remove the distinction between internal and external scripts.
Pgbench just execute scripts, some of them may be internal...

As a side effect, all scripts can be accumulated "pgbench -B -N -S -f ..." 
would execute 4 scripts, 3 of which internal (tpc-b, simple-update, 
select-only and another externally supplied one).

Also add a weight option to change the probability of choosing some scripts
when several are available.

Hmmm... Not sure that the --per-script-stats option is really useful. The 
stats could always be shown when several scripts are executed?

   sh> ./pgbench -T 3 -B -N -w 2 -S -w 7 --per-script-stats
   starting vacuum...end.
   transaction type: multiple scripts
   scaling factor: 1
   query mode: simple
   number of clients: 1
   number of threads: 1
   duration: 3 s
   number of transactions actually processed: 3192
   latency average: 0.940 ms
   tps = 1063.756045 (including connections establishing)
   tps = 1065.412737 (excluding connections establishing)
   SQL script 0: <builtin: TPC-B (sort of)>
    - weight is 1
    - 297 transactions (tps = 98.977301)
    - latency average = 3.001 ms
    - latency stddev = 1.320 ms
   SQL script 1: <builtin: simple update>
    - weight is 2
    - 621 transactions (tps = 206.952539)
    - latency average = 2.506 ms
    - latency stddev = 1.194 ms
   SQL script 2: <builtin: select only>
    - weight is 7
    - 2274 transactions (tps = 757.826205)
    - latency average = 0.236 ms
    - latency stddev = 0.083 ms

-- 
Fabien

Commits

  1. pgbench: Allow changing weights for scripts