X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id E4F9252896 for ; Thu, 9 Jun 2005 04:51:45 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 96295-01 for ; Thu, 9 Jun 2005 07:51:36 +0000 (GMT) Received: from ciao.gmane.org (main.gmane.org [80.91.229.2]) by svr1.postgresql.org (Postfix) with ESMTP id C3DE352864 for ; Thu, 9 Jun 2005 04:51:34 -0300 (ADT) Received: from root by ciao.gmane.org with local (Exim 4.43) id 1DgH1x-00021p-OH for pgsql-sql@postgresql.org; Thu, 09 Jun 2005 09:00:45 +0200 Received: from gateway.mgm-edv.de ([212.18.1.110]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 09 Jun 2005 09:00:45 +0200 Received: from spam_eater by gateway.mgm-edv.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 09 Jun 2005 09:00:45 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: pgsql-sql@postgresql.org From: Thomas Kellerer Subject: Re: SELECT very slow Date: Thu, 09 Jun 2005 08:58:51 +0200 Lines: 24 Message-ID: References: <27961.1118275606@sss.pgh.pa.us> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: gateway.mgm-edv.de User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; de-AT; rv:1.7.6) Gecko/20050319 Mnenhy/0.7.2.0 X-Accept-Language: de, de-at, en-us, en In-Reply-To: <27961.1118275606@sss.pgh.pa.us> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.233 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200506/134 X-Sequence-Number: 21735 On 09.06.2005 02:06 Tom Lane wrote: > Thomas Kellerer writes: > >>Is there anything I can do, to convince PG to return the first row more >>quickly? > > > libpq's API for PQresult is such that it really doesn't have any choice > but to collect the full result set before it hands you back the > PQresult. I don't know JDBC very well but I think it has similar > semantic constraints. > > The solution is to use a cursor and FETCH a reasonably small number of > rows at a time. > My understanding was that setting the fetchSize() to 1 in JDBC would force the use of a cursor. I'll have to go through the JDBC docs again to check how I can enforce this. Thanks for the answer though Thomas