Re: [HACKERS] Re: pgsql: Add missing optimizer hooks for function cost and number of rows.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Simon Riggs <simon(at)2ndQuadrant(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, pgsql-committers(at)postgresql(dot)org, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [HACKERS] Re: pgsql: Add missing optimizer hooks for function cost and number of rows.
Date: 2010-04-24 16:59:30
Message-ID: 8730.1272128370@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

Simon Riggs <simon(at)2ndQuadrant(dot)com> writes:
> We can override table stats but not functions stats. I noticed that hole
> in the previous implementation, and rectified it with the intention of
> helping users with what I saw as a small, low risk patch that exactly
> followed existing code. It would seem I did that too quickly without
> realising that an objection would occur.

Well, you did it without much thought at all. I think this episode is a
perfect demonstration of why we ask for concrete use-cases for proposed
hooks. If you'd actually tried to write something that used the hook,
you'd surely have noticed that it wasn't being passed the information
that it would need to do anything useful, and you'd probably have
recognized the problem that there's no good way for a single hook
function to provide an extensible collection of function-specific
knowledge.

But the other point is that people aren't going to want to have to write
C-language hook functions in order to provide estimators for
user-defined functions. We need to think of something higher-level than
that. I think there was some discussion of generalizing the COST/ROWS
constants into SQL expressions using the function arguments, which the
planner could evaluate if it could reduce the arguments to constants.
I'm not sure if that would be adequate or even useful, but it seems more
likely to be helpful than a bare hook function.

regards, tom lane

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Simon Riggs 2010-04-24 17:13:46 Re: [HACKERS] Re: pgsql: Add missing optimizer hooks for function cost and number of rows.
Previous Message Simon Riggs 2010-04-24 16:41:28 Re: [HACKERS] Re: pgsql: Add missing optimizer hooks for function cost and number of rows.

Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Riggs 2010-04-24 17:13:46 Re: [HACKERS] Re: pgsql: Add missing optimizer hooks for function cost and number of rows.
Previous Message Simon Riggs 2010-04-24 16:41:28 Re: [HACKERS] Re: pgsql: Add missing optimizer hooks for function cost and number of rows.