Unix Technical Forum

Re: [JDBC] Statement Timeout and Locking

This is a discussion on Re: [JDBC] Statement Timeout and Locking within the pgsql Hackers forums, part of the PostgreSQL category; --> Kris Jurka <books@ejurka.com> writes: > This actually is the problem. It works as three separate statements, but > fails ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Hackers

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-11-2008, 04:36 AM
Tom Lane
 
Posts: n/a
Default Re: [JDBC] Statement Timeout and Locking

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

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 03:05 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com