Peter Eisentraut <peter_e@gmx.net> writes:
> I've seen a number of bug reports that would indicate to me the GEQO works
> less than perfectly. I vividly recall how, while working on my own code,
> mere additions of dummy clauses like '... AND 5=5' altered query results
> in seemingly random ways.
The choices made by GEQO are intentionally random, so I would expect
variation in tuple output order even for repetitions of the identical
query. If you got a semantically different result, that would indeed
be a bug. But it would most likely be a bug in the core planner, since
GEQO has essentially no influence over whether the produced plan is
correct or not. GEQO merely forces specific choices of join order.
All else is in the core planner.
> That was admittedly quite a while ago, but the
> GEQO code hasn't changed since.
The planner has changed quite markedly over the past couple releases,
so I don't put a lot of stock in old anecdotes. Let's see a test case.
regards, tom lane