>
> No, those aren't the same plans. In particular
> what's bothering me is
> the lack of any sort in the first plan you showed (the one
> with
> HashAggregate at the top). That shouldn't be possible
> because of the
> ORDER BY --- a hash aggregate will deliver unsorted output
> so there
> should be a sort step above it.
Ah, retracing my steps forget that; there's no sort because it's not the same query at all.
explain Select
mult_ord.mult_ref
From
credit Inner Join
mult_ord On mult_ord.transno = credit.transno
Where
(credit.show = 450000 Or
credit.show = 450001) And
credit."date" >= '2009-02-16' And
credit."date" <= '2009-02-16' And
credit.cancelled = ' ' group by mult_ref;
Lets just say it's been a long day.
Going back to my original point though, is there any way to get the planner to choose a better plan for the original
distinctquery? Or is it just a simple no because I set enable_sort to off?