From: | Roberto Grandi <roberto(dot)grandi(at)trovaprezzi(dot)it> |
---|---|
To: | Federico <rotellaro(at)gmail(dot)com> |
Cc: | pgsql-admin(at)postgresql(dot)org |
Subject: | Re: Script timeout |
Date: | 2013-09-17 17:52:14 |
Message-ID: | 1982894261.357898.1379440334960.JavaMail.root@trovaprezzi.it |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-admin |
Hi,
I think your suggestion is
SELECT set_config('statement_timeout','1000 s',false); -- enable timeout
--
-- DO SQL Statements here
--
SELECT set_config('statement_timeout','0',false); -- disable timeout
Am I correct? Moreover what can happen if another query runs on the same connection pool ?
I would limit the effect only on this specific query.
Roberto
----- Original Message -----
From: "Federico" <rotellaro(at)gmail(dot)com>
To: "Roberto Grandi" <roberto(dot)grandi(at)trovaprezzi(dot)it>
Cc: pgsql-admin(at)postgresql(dot)org
Sent: Tuesday, September 17, 2013 6:37:09 PM
Subject: Re: [ADMIN] Script timeout
This should work.
SELECT set_config('statement_timeout','1000 s',false);
The set_config function is quite flexible as can accept dynamic values.
More info here
http://www.postgresql.org/docs/current/static/functions-admin.html
I've used successfully to change the script timeout for each statement in
my maintenance scripts using a temporary table to store the deadline.
Kind Regards
Federico
On 17 September 2013 17:23, Roberto Grandi <roberto(dot)grandi(at)trovaprezzi(dot)it>wrote:
>
> Dear all,
>
> i would set a script timeout from a .net application. My problem regards
> how to make sure that time out will be reset at the end of the script such
> as
>
> SET statement_timeout 1000
> SELECT pg_sleep(2);
>
> trowhs exception
>
>
> After that
>
> SELECT pg_sleep(2);
>
> wouldn't throw exception.
>
>
> Can you help me to solve this issue?
>
> Many thanks in advance.
>
> BR
> Roberto
>
>
> --
> Sent via pgsql-admin mailing list (pgsql-admin(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-admin
>
--
Federico Campoli
DE MATERIALIZING, UK, Planet Earth, The Milky Way Galaxy
/*******************************
There's no point being grown-up if you can't be childish sometimes.
(The fourth Doctor)
http://www.pgdba.co.uk
*******************************/
Hi
From | Date | Subject | |
---|---|---|---|
Next Message | bricklen | 2013-09-17 19:02:13 | Re: Dumping a database that is not accepting commands? |
Previous Message | Natalie Wenz | 2013-09-17 16:48:10 | Re: Dumping a database that is not accepting commands? |