X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 970F3D7FA9 for ; Thu, 25 Aug 2005 10:10:48 -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 75142-01 for ; Thu, 25 Aug 2005 13:10:44 +0000 (GMT) Received: from wolff.to (wolff.to [66.93.197.194]) by svr1.postgresql.org (Postfix) with SMTP id 4E2FCD7286 for ; Thu, 25 Aug 2005 10:10:42 -0300 (ADT) Received: (qmail 17391 invoked by uid 500); 25 Aug 2005 13:10:21 -0000 Date: Thu, 25 Aug 2005 08:10:21 -0500 From: Bruno Wolff III To: Bo Lorentsen Cc: Michael Fuhr , Russell Simpkins , pgsql-sql@postgresql.org Subject: Re: Number of rows in a cursor ? Message-ID: <20050825131021.GC15100@wolff.to> Mail-Followup-To: Bruno Wolff III , Bo Lorentsen , Michael Fuhr , Russell Simpkins , pgsql-sql@postgresql.org References: <430C4C70.2010005@netgroup.dk> <430C6CFF.9070304@netgroup.dk> <20050824131921.GA39444@winnie.fuhr.org> <430C842C.8000504@netgroup.dk> <20050824174612.GB80642@winnie.fuhr.org> <430D6A8F.6000404@netgroup.dk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <430D6A8F.6000404@netgroup.dk> User-Agent: Mutt/1.5.6i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.006 required=5 tests=[AWL=0.006] X-Spam-Level: X-Archive-Number: 200508/240 X-Sequence-Number: 22468 On Thu, Aug 25, 2005 at 08:51:59 +0200, Bo Lorentsen wrote: > Michael Fuhr wrote: > > >Right -- when you open a cursor PostgreSQL doesn't know how many > >rows it will return. PostgreSQL selects a query plan based on an > >*estimate* of how many rows the query will return, but until you > >fetch all the rows you can't know for sure how many rows there will > >be. > > > > > So if i make a but data set as result of a cursor I only "pay" for the > rows I actually fetch ? There is usually some overhead for set up, though I believe quick starting plans are favored for cursor queries.