Re: Functionscan estimates - Mailing list pgsql-performance

From Alvaro Herrera
Subject Re: Functionscan estimates
Date
Msg-id 20050408235731.GA6279@dcc.uchile.cl
Whole thread Raw
In response to Re: Functionscan estimates  (Josh Berkus <josh@agliodbs.com>)
Responses Re: Functionscan estimates  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-performance
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 (<alvherre[@]dcc.uchile.cl>)
"A wizard is never late, Frodo Baggins, nor is he early.
 He arrives precisely when he means to."  (Gandalf, en LoTR FoTR)

pgsql-performance by date:

Previous
From: Josh Berkus
Date:
Subject: Re: Functionscan estimates
Next
From: Tom Lane
Date:
Subject: Re: Functionscan estimates