Subject RE: [ib-support] FIRST must be before DISTINCT
Author Dmitry Yemanov
Hi Nando,

> if the DISTINCT's argument has an index, it is used and you get an
> ordered result set.
> I still won't be sorting, but the rows will be in order.
> At least that's what I recall.

Sorry, this is not true. With DISTINCT, indices are not used, but the result
buffer is sorted. The plan is something like PLAN SORT (<tablename> NATURAL)
even if the primary key (or any other index) exists for the DISTINCT's
argument. I can't recall at the moment whether IB4/5 behaves in the same
manner or differently.

Cheers,
Dmitry