Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 18F496342F1 for ; Fri, 30 Oct 2009 14:35:40 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 52288-03-3 for ; Fri, 30 Oct 2009 17:35:32 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from melbourne.micfo.com (melbourne.micfo.com [115.124.106.27]) by mail.postgresql.org (Postfix) with ESMTP id 69801633D36 for ; Fri, 30 Oct 2009 14:35:30 -0300 (ADT) Received: from 87-204-194-135.dg-net.pl ([87.204.194.135]:56761 helo=radek.localnet) by melbourne.micfo.com with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.69) (envelope-from ) id 1N3vNr-0001gq-0J for pgsql-jdbc@postgresql.org; Fri, 30 Oct 2009 13:35:31 -0400 To: pgsql-jdbc@postgresql.org Subject: Re: Implementation of query timeout From: =?utf-8?q?Rados=C5=82aw_Smogura?= Date: Fri, 30 Oct 2009 18:35:25 +0100 MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <200910301835.25701.rsmogura@softperience.eu> X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - melbourne.micfo.com X-AntiAbuse: Original Domain - postgresql.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - softperience.eu X-Source: X-Source-Args: X-Source-Dir: X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.98 tagged_above=-10 required=5 tests=BAYES_00=-2.599, RCVD_IN_SORBS_WEB=0.619 X-Spam-Level: X-Archive-Number: 200910/45 X-Sequence-Number: 20047 Dnia pi=C4=85tek 30 pa=C5=BAdziernik 2009 o 08:47:02 napisa=C5=82e=C5=9B: > Radoslaw Smogura wrote: > > I read a TODO list, and I decided to help a bit. So I've tried to > > implement queryTimeout, currently ony for non-batch statements. You can > > see code, at http://rsmogura.net/pgsql/pgsql_jdbc_querytimeout.tar.bz2 > > and analyze, chceck and test it. > > > > Small description how it works. > > > > 1. When the query is executed it checks if timeout > 0. > > 2. If yes it creates TimerTask and add it to the queue, then sends the > > query to server. > > 3. On timeout and if statement hasn't ended cancelStatement is called(). >=20 > Maybe I am missing something there, but wouldn't it be much easier > to send the following to the server: >=20 > SET statement_timeout=3D >=20 > Then all statements that time out throw an exception with SQLSTATE 57014, > and there's no need for separate threads and canceling the query. >=20 > Yours, > Lauernz Albe >=20 Hello, SET statement_timeout only set timeout for statement processing on server, = it=20 not include the time of transfering data, which can be long for BLOBs. I've= =20 found few posts that this is not enaugh solution "SET statement_timeout" fr= om=20 above reasons. It's way those timeout is implemented in JDBC side. Kind regards, Radek Smogura.