From: Tom Lane <tgl@sss.pgh.pa.us>
To: Kris Jurka <books@ejurka.com>
Cc: Markus Schaber <schabi@logix-tt.com>
Cc: pgsql-jdbc@postgresql.org <pgsql-jdbc@postgresql.org>
Cc: pgsql-hackers@postgresql.org
Subject: Re: Statement Timeout and Locking
Date: Thu, 28 Apr 2005 11:59:41 -0400
Message-ID: <12112.1114703981@sss.pgh.pa.us> (raw)
In-Reply-To: <Pine.BSO.4.56.0504281015070.5783@leary.csoft.net>
References: <4270BAE0.1020402@logix-tt.com>
<11053.1114697497@sss.pgh.pa.us>
<Pine.BSO.4.56.0504280920080.30994@leary.csoft.net>
<Pine.BSO.4.56.0504281015070.5783@leary.csoft.net>
Kris Jurka <books@ejurka.com> writes:
> This actually is the problem. It works as three separate statements, but
> fails as one. The server doesn't seem to recognize the SET when other
> commands come in before Sync.
[ reads some code... ] The problem is that postgres.c only inspects
StatementTimeout when start_xact_command starts a transaction command,
and the placement of finish_xact_command calls is such that that's
not going to happen until after Sync. So the upshot is that the
"SET statement_timeout" isn't going to have effect until after Sync
(or after a transaction-control command, but there are none in your
example).
This suggests that the statement_timeout stuff is being done at the wrong
place. I'm not sure exactly what the more-right places would be for
V3 protocol though. What exactly would you expect statement_timeout to
cover in a Parse/Bind/Execute world --- especially if those aren't
issued in a purely sequential fashion?
A very simple definition would be that each Parse, Bind, or Execute
action is independently constrained by statement_timeout, but that would
act significantly differently from the simple-query case if planning
takes long enough to be a factor. (Bear in mind that planning can
include constant-folding of user-defined functions, so at least in some
cases you can imagine people would want statement_timeout to constrain
planning.) Also that would imply three times as many timer
enable/disable kernel calls, which might be an annoying amount of
overhead.
Anyway the short-term answer for Markus is "don't do it that way".
We ought to think about making the backend's behavior more consistent,
though.
regards, tom lane
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: tgl@sss.pgh.pa.us, books@ejurka.com, schabi@logix-tt.com, pgsql-hackers@postgresql.org
Subject: Re: Statement Timeout and Locking
In-Reply-To: <12112.1114703981@sss.pgh.pa.us>
References: <4270BAE0.1020402@logix-tt.com> <11053.1114697497@sss.pgh.pa.us> <Pine.BSO.4.56.0504280920080.30994@leary.csoft.net> <Pine.BSO.4.56.0504281015070.5783@leary.csoft.net> <12112.1114703981@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox