Re: pgbench post-connection command - Mailing list pgsql-hackers

From Simon Riggs
Subject Re: pgbench post-connection command
Date
Msg-id CA+U5nMKfQoDmrUrQa0OeBxCBGrA2D764aLkcmVgCPiSiSb4Oqg@mail.gmail.com
Whole thread Raw
In response to Re: pgbench post-connection command  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: pgbench post-connection command  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Thu, Jan 12, 2012 at 3:26 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Simon Riggs <simon@2ndQuadrant.com> writes:
>> New -x option for pgbench executes the given command once after
>> connection of each session.
>
> This seems rather poorly designed, mainly because there's no reason to
> think that a single command would be sufficient.

It supports multiple commands via multi-statement requests
e.g.

-x "SET this = on; SET that = off"


> What would make more sense to me is to add an option for a one-time
> script, or possibly extend the script language to allow marking some
> commands as "do once".

That seems a little overcooked. Any long preparatory script can be
executed before pgbench. So this command is only for options that need
to be set on each database session. If you really do have a long
script that needs to be run for each session, you can set the command
to "SELECT execute_my_initial_function()" and then write your script
as a function.

--
 Simon Riggs                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: pgbench post-connection command
Next
From: "Kevin Grittner"
Date:
Subject: Re: Remembering bug #6123