Re: Functionscan estimates

From: Alvaro Herrera
Subject: Re: Functionscan estimates
Date: ,
Msg-id: 20050408235731.GA6279@dcc.uchile.cl
(view: Whole thread, Raw)
In response to: Re: Functionscan estimates  (Josh Berkus)
Responses: Re: Functionscan estimates  (Tom Lane)
List: pgsql-performance

Tree view

Functionscan estimates  (Josh Berkus, )
 Re: Functionscan estimates  (Michael Fuhr, )
  Re: Functionscan estimates  (Alvaro Herrera, )
   Re: Functionscan estimates  (Josh Berkus, )
    Re: Functionscan estimates  (Alvaro Herrera, )
     Re: Functionscan estimates  (Tom Lane, )
      Re: Functionscan estimates  (PFC, )
      Re: Functionscan estimates  ("Jim C. Nasby", )
       Re: Functionscan estimates  (Tom Lane, )
        Re: Functionscan estimates  (Neil Conway, )
         Re: Functionscan estimates  (Josh Berkus, )
      Re: Functionscan estimates  (Neil Conway, )
    Re: Functionscan estimates  (PFC, )

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:

From: Tom Lane
Date:
Subject: Re: Functionscan estimates
From: PFC
Date:
Subject: Re: Functionscan estimates