Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
Thread:
Lists: pgsql-committerspgsql-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

pgsql-hackers by date

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

pgsql-committers by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group