Re: pgbench --startup option

Поиск
Список
Период
Сортировка
От Jeff Janes
Тема Re: pgbench --startup option
Дата
Msg-id CAMkU=1xDo9QpcKw9NexHZDsUHujsz8p+-Ci-wRYute-ZVi5a2Q@mail.gmail.com
обсуждение исходный текст
Ответ на Re: pgbench --startup option  (Robert Haas <robertmhaas@gmail.com>)
Список pgsql-hackers
On Tuesday, June 25, 2013, Robert Haas wrote:
On Thu, Jun 20, 2013 at 1:46 PM, Jeff Janes <jeff.janes@gmail.com> 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

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Amit Kapila
Дата:
Сообщение: Re: ALTER SYSTEM SET command to change postgresql.conf parameters (RE: Proposal for Allow postgresql.conf values to be changed via SQL [review])
Следующее
От: Hari Babu
Дата:
Сообщение: Re: fixing pg_ctl with relative paths