X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 124B25387A; Thu, 28 Apr 2005 12:59:48 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 71073-07; Thu, 28 Apr 2005 15:59:44 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 2F34853372; Thu, 28 Apr 2005 12:59:43 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j3SFxfN3012113; Thu, 28 Apr 2005 11:59:41 -0400 (EDT) To: Kris Jurka Cc: Markus Schaber , "pgsql-jdbc@postgresql.org" , pgsql-hackers@postgresql.org Subject: Re: Statement Timeout and Locking In-reply-to: References: <4270BAE0.1020402@logix-tt.com> <11053.1114697497@sss.pgh.pa.us> Comments: In-reply-to Kris Jurka message dated "Thu, 28 Apr 2005 10:22:01 -0500" Date: Thu, 28 Apr 2005 11:59:41 -0400 Message-ID: <12112.1114703981@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200504/204 X-Sequence-Number: 12811 Kris Jurka 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