Re: An Idea for planner hints - Mailing list pgsql-hackers

From Tom Lane
Subject Re: An Idea for planner hints
Date
Msg-id 12742.1155068085@sss.pgh.pa.us
Whole thread Raw
In response to Re: An Idea for planner hints  (Martijn van Oosterhout <kleptog@svana.org>)
Responses Re: An Idea for planner hints
Re: An Idea for planner hints
Re: An Idea for planner hints
Re: An Idea for planner hints
List pgsql-hackers
Martijn van Oosterhout <kleptog@svana.org> writes:
> ISTM theat the easiest way would be to introduce a sort of predicate
> like so:

> SELECT * FROM foo, bar WHERE pg_selectivity(foo.a = bar.a, 0.1);

The one saving grace of Florian's proposal was that you could go hack
the statistics *without* changing your queries.  This throws that away
again.

The thing I object to about the "I want to decorate my queries with
planner hints" mindset is that it's coming at it from the wrong
direction.  You should never be thinking in terms of "fix this one
query", because that just leads back into the same dead end that your
fix doesn't work tomorrow.  What you *should* be thinking about is "why
did the planner get this wrong, and how do I fix the generic problem?".
If you attack it that way then your fix is much more likely to work on
the next slightly-different query.

So some kind of override for statistical guesses doesn't seem completely
silly to me.  But it needs to be declarative information that's stored
somewhere out of view of the actual SQL queries.  IMHO anyway.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: proposal for 8.3: Simultaneous assignment for PL/pgSQL
Next
From: Martijn van Oosterhout
Date:
Subject: Re: An Idea for planner hints