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 C6E4F52814 for ; Wed, 8 Jun 2005 21:06:54 -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 92458-03 for ; Thu, 9 Jun 2005 00:06:45 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id A507E5287A for ; Wed, 8 Jun 2005 21:06:43 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j5906kAO027962; Wed, 8 Jun 2005 20:06:46 -0400 (EDT) To: Thomas Kellerer Cc: pgsql-sql@postgresql.org Subject: Re: SELECT very slow In-reply-to: References: Comments: In-reply-to Thomas Kellerer message dated "Wed, 08 Jun 2005 23:46:41 +0200" Date: Wed, 08 Jun 2005 20:06:46 -0400 Message-ID: <27961.1118275606@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200506/122 X-Sequence-Number: 21723 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. regards, tom lane