Re: pgbench --startup option

From: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pgbench --startup option
Date: 2013-06-26 04:54:08
Message-ID: CAMkU=1xDo9QpcKw9NexHZDsUHujsz8p+-Ci-wRYute-ZVi5a2Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tuesday, June 25, 2013, Robert Haas wrote:

> On Thu, Jun 20, 2013 at 1:46 PM, Jeff Janes <jeff(dot)janes(at)gmail(dot)com<javascript:;>>
> wrote:
> > I've fixed a conflict, and I've removed extraneous semicolons from the C.
> >
> > I've left in the fixing of some existing bad indenting in the existing
> code,
> > which is not strictly related to my change.
>
> OK, I like this idea a lot, but I have a question. Right now, to use
> this, you have to supply the startup SQL on the command line. And
> that could definitely be useful. But ISTM that you might also want to
> take the startup SQL from a file, and indeed you might well want to
> include metacommands in there.

I had not previously considered making the argument to --startup be the
name of a file rather than the command itself.

I had at first wanted to make a new metacommand named \startup which could
be added into regular "-f" files, but realized that that would make it
harder to work with the default supplied transactions, and would be
substantially harder to implement. (And it is somewhat unclear what to do
when there are multiple -f given--take the UNION ALL of them in
command-line order, I guess)

> Maybe that's getting greedy, but the
> rate at which people are adding features to pgbench suggests to me
> that it won't be long before this isn't enough.
>
> Thoughts?
>

On a related note, I have also occasionally wished for a variant of -f
which would read the argument as the contents rather than as the name of a
file supplying the contents. That way a shell script to run a custom
transaction could be self-contained (both -c and -j etc as well the
contents of -f being in a single file, and so nothing to get out of sync or
misplaced).

So thinking about this as a more general problem now, I see that I can use
a bash trick to get what I want, if given what you want (example written in
terms of -f not --startup, as -f already exists in the needed form)

pgbench -f <(echo -e 'select count(*) from pgbench_accounts')

It is a little less clean, but workable.

So I now think --startup should take a file, as that is more consistent
with what other pgbench options take, and still allows me to do what I want
fairly easily.

I'll look into re-writing it to work in this way. But probably not during
this commitfest.

Thanks,

Jeff

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2013-06-26 05:35:52 Re: Reduce maximum error in tuples estimation after vacuum.
Previous Message Amit Kapila 2013-06-26 04:51:00 Re: ALTER SYSTEM SET command to change postgresql.conf parameters (RE: Proposal for Allow postgresql.conf values to be changed via SQL [review])