Re: pgbench stats per script & other stuff

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pgbench stats per script & other stuff
Date: 2016-01-26 01:22:31
Message-ID: 20160126012231.GA549232@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Fabien COELHO wrote:

> a) add -b option for cumulating builtins and rework internal script
> management so that builtin and external scripts are managed the
> same way.

I tweaked this a bit. I found a bug in threadRun: it was reading the
commands first, and setting st->use_file later. This led to the wrong
commands being read.

Some other less interesting changes:

* made chooseScript have the logic to react to single existing script;
no need to inject ternary operators in each caller to check for that

* Added a debug line every time a script is chosen,
+ if (debug)
+ fprintf(stderr, "client %d executing script \"%s\"\n", st->id,
+ sql_script[st->use_file].name);
(I'd have liked to have chooseScript itself do it, but it doesn't
have the script name handy. Maybe this indicates that the data
structures are slightly wrong.)

* Added a separate routine to list available scripts; originally that
was duplicated in "-b list" and when -b got an invalid script name.

* In usage(), I split out the options to select a script instead of
mixing them within "Benchmarking options"; also changed wording of
parenthical comment, no longer carrying the full list of scripts (a
choice which also omitted "-b list" itself):
+ "\nOptions to select what to run:\n"
+ " -b, --builtin=NAME add buitin script (use \"-b list\" to display\n"
+ " available scripts)\n"
+ " -f, --file=FILENAME add transaction script from FILENAME\n"
+ " -N, --skip-some-updates skip updates of pgbench_tellers and pgbench_branches\n"
+ " (same as \"-b simple-update\")\n"
+ " -S, --select-only perform SELECT-only transactions\n"
+ " (same as \"-b select-only\")\n"

I couldn't find a better heading to use there, so that'll have to do
unless someone has a better idea.

Some other trivial changes. Patch attached. I plan to push this as
soon as I'm able.

Álvaro Herrera
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Attachment Content-Type Size
pgbench-script-stats-14-a.patch text/x-diff 25.7 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Kouhei Kaigai 2016-01-26 02:09:58 Re: [Proposal] Table partition + join pushdown
Previous Message Michael Paquier 2016-01-26 01:21:18 Re: Add generate_series(date, date) and generate_series(date, date, integer)