Re: setting query timeout as part of the query

From: Merlin Moncure <mmoncure(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Steve Crawford <scrawford(at)pinpointresearch(dot)com>, William Morgan <william(at)introhq(dot)com>, pgsql novice <pgsql-novice(at)postgresql(dot)org>
Subject: Re: setting query timeout as part of the query
Date: 2014-09-30 22:03:26
Message-ID: CAHyXU0zYbZ1BBnSz2YhvLekm7RxA9nqD7=e+RafC_EGRMeraqw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On Tue, Sep 30, 2014 at 3:53 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Steve Crawford <scrawford(at)pinpointresearch(dot)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

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message JimmyJ 2014-10-01 10:46:56 Rename entries with an increment
Previous Message William Morgan 2014-09-30 21:58:20 Re: setting query timeout as part of the query