Re: pgbench stats per script & other stuff

From: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
To: Fabien <coelho(at)cri(dot)ensmp(dot)fr>
Cc: PostgreSQL Developers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pgbench stats per script & other stuff
Date: 2016-03-19 22:41:41
Message-ID: CAMkU=1wJapNYRPsieqxWEkgsTiFZguqxmjwv+1YT_dD5+G2R+A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Jul 17, 2015 at 6:50 AM, Fabien <coelho(at)cri(dot)ensmp(dot)fr> wrote:
>
> 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.

I was eager to use this to do some performance testing on a series of
workloads gradually transitioning from write-heavy to read-only.

So I wanted to do something like:

for f in `seq 0 5 100`; do
pgbench -T 180 -c8 -j8 -b tpcb-like(at)$f -b select-only(at)100
done;

But, I'm not allowed to specify a weight of zero. That means I have
to special-case the first iteration of the "for" loop where $f is
zero. I think it would be more convenient if I was allowed to specify
a zero weight, and the script would just ignore that script. All I
had to do to make this work is remove the check that prevents from
setting the weight to zero. But then I would need to add in a check
that the sum of all weights is not zero, which I have done here.

We could get more complex by not adding a zero-weight script into the
array of scripts at all, rather than adding it in a way where it can
never be selected. But then that would complicate the parsing of the
per-script stats report, when one of the scripts was no longer
reported. I like this way better.

Would this be a welcome change?

Cheers,

Jeff

Attachment Content-Type Size
pgbench_zero_weight.patch application/octet-stream 1.2 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2016-03-19 23:06:08 Re: VS 2015 support in src/tools/msvc
Previous Message Fabien COELHO 2016-03-19 22:18:24 Re: extend pgbench expressions with functions