X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 1FBEC329D3E for ; Tue, 14 Sep 2004 02:49:23 +0100 (BST) 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 39161-09 for ; Tue, 14 Sep 2004 01:49:15 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 0B8BE329D15 for ; Tue, 14 Sep 2004 02:49:18 +0100 (BST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.11/8.12.11) with ESMTP id i8E1nE4T028433; Mon, 13 Sep 2004 21:49:15 -0400 (EDT) To: Stephen Crowley Cc: pgsql-performance@postgresql.org Subject: Re: Large # of rows in query extremely slow, not using index In-reply-to: <3f71fdf104091318228099815@mail.gmail.com> References: <3f71fdf104091317515c756512@mail.gmail.com> <28088.1095124267@sss.pgh.pa.us> <3f71fdf104091318228099815@mail.gmail.com> Comments: In-reply-to Stephen Crowley message dated "Mon, 13 Sep 2004 20:22:19 -0500" Date: Mon, 13 Sep 2004 21:49:14 -0400 Message-ID: <28432.1095126554@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200409/101 X-Sequence-Number: 8229 Stephen Crowley writes: > On Mon, 13 Sep 2004 21:11:07 -0400, Tom Lane wrote: >> Stephen Crowley writes: >>> Does postgres cache the entire result set before it begins returning >>> data to the client? >> >> The backend doesn't, but libpq does, and I think JDBC does too. > That is incredible. Why would libpq do such a thing? Because the API it presents doesn't allow for the possibility of query failure after having given you back a PGresult: either you have the whole result available with no further worries, or you don't. If you think it's "incredible", let's see you design an equally easy-to-use API that doesn't make this assumption. (Now having said that, I would have no objection to someone extending libpq to offer an alternative streaming API for query results. It hasn't got to the top of anyone's to-do list though ... and I'm unconvinced that psql could use it if it did exist.) regards, tom lane