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 99B9953573 for ; Sat, 9 Apr 2005 00:57:44 +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 78020-10 for ; Fri, 8 Apr 2005 23:57:35 +0000 (GMT) Received: from sunsite.dcc.uchile.cl (sunsite.dcc.uchile.cl [192.80.24.2]) by svr1.postgresql.org (Postfix) with ESMTP id 5563E5321A for ; Sat, 9 Apr 2005 00:57:34 +0100 (BST) Received: from anakena.dcc.uchile.cl (anakena [192.80.24.6]) by sunsite.dcc.uchile.cl (8.12.11/8.12.11) with ESMTP id j38NvVlL009741; Fri, 8 Apr 2005 19:57:31 -0400 (CLT) Received: by anakena.dcc.uchile.cl (Postfix, from userid 4151) id A9C6352A34; Fri, 8 Apr 2005 19:57:31 -0400 (CLT) Date: Fri, 8 Apr 2005 19:57:31 -0400 From: Alvaro Herrera To: Josh Berkus Cc: Michael Fuhr , pgsql-performance@postgresql.org Subject: Re: Functionscan estimates Message-ID: <20050408235731.GA6279@dcc.uchile.cl> References: <200504081515.50340.josh@agliodbs.com> <20050408223820.GA17450@winnie.fuhr.org> <20050408224556.GC19458@dcc.uchile.cl> <200504081604.27845.josh@agliodbs.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200504081604.27845.josh@agliodbs.com> User-Agent: Mutt/1.5.8i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.345 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE X-Spam-Level: X-Archive-Number: 200504/183 X-Sequence-Number: 11580 On Fri, Apr 08, 2005 at 04:04:27PM -0700, Josh Berkus wrote: > My solution would be a lot simpler, since we could simply populate > pg_proc.proestrows with "1000" by default if not changed by the DBA. In an > even better world, we could tie it to a table, saying that, for example, > proestrows = my_table*0.02. The problem with that approach is that it can't differ depending on the arguments to the function, so it too seems limited to me. Ideally an estimator would be able to peek at other table statistics and do some computation with them, just like other nodes are able to. Another idea would be have an estimator function (pg_proc.proestimator) for each regular function. The estimator would be a very cheap function to be called with the same arguments, and it would return the estimated number of tuples the other function would return. The default estimator could be "return 1000". -- Alvaro Herrera () "A wizard is never late, Frodo Baggins, nor is he early. He arrives precisely when he means to." (Gandalf, en LoTR FoTR)