Re: pgbench: Skipping the creating primary keys after initialization

From: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
To: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Robert Haas <robertmhaas(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pgbench: Skipping the creating primary keys after initialization
Date: 2017-09-05 00:37:44
Views: Raw Message | Whole Thread | Download mbox
Lists: pgsql-hackers

On Tue, Sep 5, 2017 at 2:33 AM, Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr> wrote:
> Hello Masahiko-san,
>>>> Currently TRUNCATE pgbench_accounts command is executed within a
>>>> transaction started immediately before it. If we move it out of the
>>>> transaction, the table data will be truncated even if the copying data
>>>> failed. Maybe we can do TRUNCATE pgbench_accounts, pgbench_history
>>>> instead. Thought?
>>> Keep the truncate in the transaction, and truncate both (or all?) tables
>>> together.
>> Attached latest patch incorporated the comments I got so far. Please
>> review it.
> "g" does not work for me yet when after "f", only the message is slightly
> different, it chokes on another dependency, branches instead of accounts.
> sh> ./pgbench -i -I ctpfg
> cleaning up...
> creating tables...
> set primary keys...
> set foreign keys...
> ERROR: cannot truncate a table referenced in a foreign key constraint
> DETAIL: Table "pgbench_history" references "pgbench_branches".
> HINT: Truncate table "pgbench_history" at the same time, or use TRUNCATE
> ... CASCADE.

Sorry, I'd missed something.

> I think that the whole data generation should be in *one* transaction which
> starts with "truncate pgbench_history, pgbench_branches, pgbench_tellers,
> pgbench_accounts;"

Agreed, and fixed.

> In passing, I think that the documentation should tell explicitely what the
> default value is (aka "ctgvp").


Attached the latest patch. Please review it.


Masahiko Sawada
NTT Open Source Software Center

Attachment Content-Type Size
pgbench_custom_initialization_v10.patch application/octet-stream 15.4 KB

In response to


Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Langote 2017-09-05 01:02:34 Re: Secondary index access optimizations
Previous Message Fabien COELHO 2017-09-04 23:05:09 Re: pgbench tap tests & minor fixes.