public inbox for [email protected]
help / color / mirror / Atom feedFrom: Tom Lane <[email protected]>
To: Fabien COELHO <[email protected]>
Cc: Yugo NAGATA <[email protected]>
Cc: [email protected]
Subject: Re: pgbench: using prepared BEGIN statement in a pipeline could cause an error
Date: Fri, 25 Mar 2022 16:19:54 -0400
Message-ID: <[email protected]> (raw)
In-Reply-To: <alpine.DEB.2.22.394.2107170650260.3143659@pseudo>
References: <[email protected]>
<alpine.DEB.2.22.394.2107170650260.3143659@pseudo>
Fabien COELHO <[email protected]> writes:
>> [...] One way to avoid these errors is to send Parse messages before
>> pipeline mode starts. I attached a patch to fix to prepare commands at
>> starting of a script instead of at the first execution of the command.
> ISTM that moving prepare out of command execution is a good idea, so I'm
> in favor of this approach: the code is simpler and cleaner.
> ISTM that a minor impact is that the preparation is not counted in the
> command performance statistics. I do not think that it is a problem, even
> if it would change detailed results under -C -r -M prepared.
I am not convinced this is a great idea. The current behavior is that
a statement is not prepared until it's about to be executed, and I think
we chose that deliberately to avoid semantic differences between prepared
and not-prepared mode. For example, if a script looks like
CREATE FUNCTION foo(...) ...;
SELECT foo(...);
DROP FUNCTION foo;
trying to prepare the SELECT in advance would lead to failure.
We could perhaps get away with preparing the commands within a pipeline
just before we start to execute the pipeline, but it looks to me like
this patch tries to prepare the entire script in advance.
BTW, the cfbot says the patch is failing to apply anyway ...
I think it was sideswiped by 4a39f87ac.
regards, tom lane
view thread (14+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected]
Subject: Re: pgbench: using prepared BEGIN statement in a pipeline could cause an error
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox