Re: setting query timeout as part of the query - Mailing list pgsql-novice

From Merlin Moncure
Subject Re: setting query timeout as part of the query
Date
Msg-id CAHyXU0zYbZ1BBnSz2YhvLekm7RxA9nqD7=e+RafC_EGRMeraqw@mail.gmail.com
Whole thread Raw
In response to Re: setting query timeout as part of the query  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-novice
On Tue, Sep 30, 2014 at 3:53 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Steve Crawford <scrawford@pinpointresearch.com> writes:
>> On 09/30/2014 12:52 PM, William Morgan wrote:
>>> My question is: is there a way to set this timeout as part of the
>>> query itself?
>
>> You could probably write a function that includes your timeout setting
>> and call that but I'm not sure that would be better than simply using a
>> transaction.
>
> IIRC, statement_timeout applies to the total time required to execute
> a *command submitted by the client*, and the active value is determined
> just before starting each command.  So you're pretty much stuck: you
> must issue the SET as a separate client-submitted command.

It sure would be nice to be able to tuck this stuff into the database.
On my team database and application side development are fairly
segregated and I prefer not to delegate such things to the application
developers.  Other stuff in this vein that you can't do server-side:

* transaction mangement
* control of isolation level
* locks to prevent serialization errors

merlin


pgsql-novice by date:

Previous
From: William Morgan
Date:
Subject: Re: setting query timeout as part of the query
Next
From: JimmyJ
Date:
Subject: Rename entries with an increment