Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VLzXD-0006iO-2J for pgsql-admin@arkaria.postgresql.org; Tue, 17 Sep 2013 17:57:59 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1VLzXC-0000Ax-DJ for pgsql-admin@arkaria.postgresql.org; Tue, 17 Sep 2013 17:57:58 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VLzXB-0000Ap-6A for pgsql-admin@postgresql.org; Tue, 17 Sep 2013 17:57:57 +0000 Received: from mail.trovaprezzi.it ([2.228.21.217]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VLzX8-0005m8-9g for pgsql-admin@postgresql.org; Tue, 17 Sep 2013 17:57:56 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.trovaprezzi.it (Postfix) with ESMTP id E57C982005; Tue, 17 Sep 2013 19:52:16 +0200 (CEST) X-Virus-Scanned: amavisd-new at zimbra.7pixel.local Received: from mail.trovaprezzi.it ([127.0.0.1]) by localhost (zimbra.7pixel.local [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 3VEGg9tfg8Zg; Tue, 17 Sep 2013 19:52:16 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by mail.trovaprezzi.it (Postfix) with ESMTP id 42EE982009; Tue, 17 Sep 2013 19:52:16 +0200 (CEST) X-Virus-Scanned: amavisd-new at zimbra.7pixel.local Received: from mail.trovaprezzi.it ([127.0.0.1]) by localhost (zimbra.7pixel.local [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 6LULXCjElF7U; Tue, 17 Sep 2013 19:52:15 +0200 (CEST) Received: from zimbra.7pixel.local (zimbra.7pixel.local [192.168.0.127]) by mail.trovaprezzi.it (Postfix) with ESMTP id F409D82005; Tue, 17 Sep 2013 19:52:14 +0200 (CEST) Date: Tue, 17 Sep 2013 19:52:14 +0200 (CEST) From: Roberto Grandi To: Federico Cc: pgsql-admin@postgresql.org Message-ID: <1982894261.357898.1379440334960.JavaMail.root@trovaprezzi.it> In-Reply-To: References: <1327626325.356780.1379434995993.JavaMail.root@trovaprezzi.it> <326366447.356781.1379435002810.JavaMail.root@trovaprezzi.it> Subject: Re: Script timeout MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Originating-IP: [95.249.7.18] X-Mailer: Zimbra 8.0.2_GA_5569 (ZimbraWebClient - FF23 (Win)/8.0.2_GA_5569) Thread-Topic: Script timeout Thread-Index: RqRGjh8S9KqbFD/GxU4NIGVQckI3kg== X-Pg-Spam-Score: 0.1 (/) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-admin Precedence: bulk Sender: pgsql-admin-owner@postgresql.org 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" To: "Roberto Grandi" Cc: pgsql-admin@postgresql.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 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@postgresql.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 -- Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-admin