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 81D3F53682 for ; Fri, 8 Apr 2005 23:59:35 +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 68071-07 for ; Fri, 8 Apr 2005 22:59:29 +0000 (GMT) Received: from davinci.ethosmedia.com (server227.ethosmedia.com [209.128.84.227]) by svr1.postgresql.org (Postfix) with ESMTP id 91295536F2 for ; Fri, 8 Apr 2005 23:59:28 +0100 (BST) X-EthosMedia-Virus-Scanned: no infections found Received: from [64.81.245.111] (account josh@agliodbs.com HELO temoku.sf.agliodbs.com) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) with ESMTP id 7212779; Fri, 08 Apr 2005 16:01:26 -0700 From: Josh Berkus Reply-To: josh@agliodbs.com Organization: Aglio Database Solutions To: Alvaro Herrera Subject: Re: Functionscan estimates Date: Fri, 8 Apr 2005 16:04:27 -0700 User-Agent: KMail/1.7.1 Cc: Michael Fuhr , pgsql-performance@postgresql.org References: <200504081515.50340.josh@agliodbs.com> <20050408223820.GA17450@winnie.fuhr.org> <20050408224556.GC19458@dcc.uchile.cl> In-Reply-To: <20050408224556.GC19458@dcc.uchile.cl> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200504081604.27845.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200504/182 X-Sequence-Number: 11579 Alvaro, Michael, > > About a month ago I mentioned that I'd find that useful. =A0In a > > followup, Christopher Kings-Lynne brought up the idea of a GUC > > variable that could give hints about the expected row count. > > That seems pretty limited ... what happens if the query contains more > that one SRF? Yeah, I'd see that as a pretty bad idea too. I don't want to tell the plan= ner=20 how many rows I expect "all functions" to return, I want to tell it how man= y=20 *one particular* function will return. > Maybe issuing some sort of special call to the function (say, with > some boolean in the call info struct) on which it returns planning data; > thus the planner can call the function itself. =A0The hard part would be > figuring out how to do it without breaking backwards compatibility with > functions that don't know how to handle that. =A0(And how to do it in > plpgsql). Or in pl/perl, or pl/python, or plsh .... doesn't sound feasable. =20 My solution would be a lot simpler, since we could simply populate=20 pg_proc.proestrows with "1000" by default if not changed by the DBA. In an= =20 even better world, we could tie it to a table, saying that, for example,=20 proestrows =3D my_table*0.02. =2D-=20 =2D-Josh Josh Berkus Aglio Database Solutions San Francisco