Re: setting connection/ query timeout

From: Daniele Varrazzo <daniele(dot)varrazzo(at)gmail(dot)com>
To: tamanna madaan <tamanna(dot)madan(at)globallogic(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: setting connection/ query timeout
Date: 2011-04-19 19:45:19
Message-ID: BANLkTi=BKcBKAwqyqpDh2xWP9h3irQsVGg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Apr 19, 2011 at 8:09 PM, tamanna madaan
<tamanna(dot)madan(at)globallogic(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Steve Crawford 2011-04-19 20:40:29 Re: Questions about Partitioning
Previous Message John R Pierce 2011-04-19 19:25:29 Re: "Service user account 'postgres' could not be created" -- 8.4.2-1 and Active Directory on Windows08 R2