Re: pgbench stats per script & other stuff - Mailing list pgsql-hackers

From Andres Freund
Subject Re: pgbench stats per script & other stuff
Date
Msg-id 20150902172617.GJ5286@alap3.anarazel.de
Whole thread Raw
In response to Re: pgbench stats per script & other stuff  (Fabien COELHO <coelho@cri.ensmp.fr>)
Responses Re: pgbench stats per script & other stuff
Re: pgbench stats per script & other stuff
List pgsql-hackers
On 2015-07-30 18:03:56 +0200, Fabien COELHO wrote:
> 
> >v6 is just a rebase after a bug fix by Andres Freund.
> >
> >Also a small question: The patch currently displays pgbench scripts
> >starting numbering at 0. Probably a little too geek... should start at 1?
> 
> v7 is a rebase after another small bug fix in pgbench.
> 
> -- 
> Fabien.

> diff --git a/doc/src/sgml/ref/pgbench.sgml b/doc/src/sgml/ref/pgbench.sgml
> index 2517a3a..99670d4 100644
> --- a/doc/src/sgml/ref/pgbench.sgml
> +++ b/doc/src/sgml/ref/pgbench.sgml
> @@ -261,6 +261,23 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
>      benchmarking arguments:
>  
>      <variablelist>
> +     <varlistentry>
> +      <term><option>-b</> <replaceable>scriptname[@weight]</></term>
> +      <term><option>--builtin</> <replaceable>scriptname[@weight]</></term>
> +      <listitem>
> +       <para>
> +        Add the specified builtin script to the list of executed scripts.
> +        An optional integer weight after <literal>@</> allows to adjust the
> +        probability of drawing the test.
> +        Available builtin scripts are: <literal>tpcb-like</>,
> +        <literal>simple-update</> and <literal>select-only</>.
> +        The provided <repleacable>scriptname</> needs only to be a prefix
> +        of the builtin name, hence <literal>simp</> would be enough to select
> +        <literal>simple-update</>.
> +       </para>
> +      </listitem>
> +     </varlistentry>

Maybe add --builtin list to show them?

> @@ -404,10 +422,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
>        <term><option>--skip-some-updates</option></term>
>        <listitem>
>         <para>
> -        Do not update <structname>pgbench_tellers</> and
> -        <structname>pgbench_branches</>.
> -        This will avoid update contention on these tables, but
> -        it makes the test case even less like TPC-B.
> +        Shorthand for <option>-b simple-update@1</>.
>         </para>
>        </listitem>
>       </varlistentry>

> @@ -511,7 +526,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
>        <term><option>--select-only</option></term>
>        <listitem>
>         <para>
> -        Perform select-only transactions instead of TPC-B-like test.
> +        Shorthand for <option>-b select-only@1</>.
>         </para>
>        </listitem>
>       </varlistentry>

I'm a bit inclined to remove these options.

>    <para>
> -   The default transaction script issues seven commands per transaction:
> +   Pgbench executes test scripts chosen randomly from a specified list.
> +   They include built-in scripts with <option>-b</> and
> +   user-provided custom scripts with <option>-f</>.
> +   Each script may be given a relative weight specified after a
> +   <literal>@</> so as to change its drawing probability.
> +   The default weight is <literal>1</>.
> + </para>

I'm wondering if percentages instead of weights would be a better
idea. That'd mean you'd be forced to be more careful when adding another
script (having to adjust the percentages of other scripts) but arguably
that's a good thing?

> +static SQLScript sql_script[MAX_SCRIPTS];
> +static struct {
> +    char *name;   /* very short name for -b ...*/
> +    char *desc;   /* short description */
> +    char *script; /* actual pgbench script */
> +} builtin_script[]

Can't we put these in the same array?

> +    printf("transaction type: %s\n",
> +           num_scripts == 1? sql_script[0].name: "multiple scripts");

Seems like it'd be more useful to simply always list the scripts +
weights here.

Greetings,

Andres Freund



pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: GIN pending clean up is not interruptable
Next
From: Alvaro Herrera
Date:
Subject: Re: Improving test coverage of extensions with pg_dump