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 ---------------------------(end of broadcast)--------------------------- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match