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 0BAC0329E87 for ; Tue, 14 Sep 2004 02:22:27 +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 33774-08 for ; Tue, 14 Sep 2004 01:22:19 +0000 (GMT) Received: from mproxy.gmail.com (rproxy.gmail.com [64.233.170.193]) by svr1.postgresql.org (Postfix) with ESMTP id DC19A329E8A for ; Tue, 14 Sep 2004 02:22:22 +0100 (BST) Received: by mproxy.gmail.com with SMTP id 80so129693rnk for ; Mon, 13 Sep 2004 18:22:19 -0700 (PDT) Received: by 10.38.179.63 with SMTP id b63mr498703rnf; Mon, 13 Sep 2004 18:22:19 -0700 (PDT) Received: by 10.38.8.4 with HTTP; Mon, 13 Sep 2004 18:22:19 -0700 (PDT) Message-ID: <3f71fdf104091318228099815@mail.gmail.com> Date: Mon, 13 Sep 2004 20:22:19 -0500 From: Stephen Crowley Reply-To: Stephen Crowley To: pgsql-performance@postgresql.org Subject: Re: Large # of rows in query extremely slow, not using index In-Reply-To: <28088.1095124267@sss.pgh.pa.us> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <3f71fdf104091317515c756512@mail.gmail.com> <28088.1095124267@sss.pgh.pa.us> 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/98 X-Sequence-Number: 8226 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. > > I'd recommend using a cursor so you can FETCH a reasonable number of > rows at a time. That is incredible. Why would libpq do such a thing? JDBC as well? I know oracle doesn't do anything like that, not sure about mysql. Is there any way to turn it off? In this case I was just using psql but will be using JDBC for the app. About cursors, I thought a jdbc ResultSet WAS a cursor, am I mistaken? Thanks, Stephen