Ray Ontko <rayo@ontko.com> writes:
> BTW, Are you sure that you need to do the "distinct"?
That's a good question to ask.
> If you do,
> then you might try putting the order_date column first in the
> select list. The distinct is requiring that all the rows be sorted
> so that they can be uniqified. I'm hoping that by putting order_date
> first in the that the sort will have to do less work to put them in
> order. (Anyone know if this will actually help?)
I don't believe it will help much if at all. Increasing sort_mem might
help, though.
regards, tom lane