Re: setting connection/ query timeout - Mailing list pgsql-general

From tamanna madaan
Subject Re: setting connection/ query timeout
Date
Msg-id 68666423656E1444A011106C4E085F4D96F313@ex3-del1.synapse.com
Whole thread Raw
In response to setting connection/ query timeout  ("tamanna madaan" <tamanna.madan@globallogic.com>)
List pgsql-general

 Thanks Daniele

-----Original Message-----
From: Daniele Varrazzo [mailto:daniele.varrazzo@gmail.com]
Sent: Wed 4/20/2011 1:15 AM
To: tamanna madaan
Cc: pgsql-general@postgresql.org
Subject: Re: [GENERAL] setting connection/ query timeout

On Tue, Apr 19, 2011 at 8:09 PM, tamanna madaan
<tamanna.madan@globallogic.com> wrote:

> Sometimes this query gets stuck for unknown reason . So, for this particular
> query I want to set a timeout
> . I dont want to change "statement_timeout" in postgresql.conf as this would
> affect all the connections/queries.
> I just want to set timeout for above mentioned query . How can I do that ??

You can set a timeout only valid for the session using SET:

=> set statement_timeout to 1000;
SET
=> select pg_sleep(2);
ERROR:  canceling statement due to statement timeout

-- Daniele

pgsql-general by date:

Previous
From: Craig Ringer
Date:
Subject: Re: pervasiveness of surrogate (also called synthetic) keys
Next
From: alan bryan
Date:
Subject: Seg Fault in backend after beginning to use xpath (PG 9.0, FreeBSD 8.1)