Subject Re: PLAN
Author ded_spb@yahoo.com
--- In ib-support@y..., "Nico Callewaert" <ncw@c...> wrote:
> For
> example if you build a JOIN, with a DISTINCT, it will not use a
index I
> guess. As far as I know DISTINCT cannot use a index ???
>

Nico, don't guess, read and try. :) Sorry for old-style SQL, you can
do the same with SQL-92.

Choice one of your 1:n pair of tables and make

Select T1.Id, T2.Id
From T1, T2
Where T2.T1_ID=T1.ID

you'll see
Plan (T1 natural, t2 index (rdb$foreign...)

Select T1.Id, T2.Id
From T1, T2
Where T1.ID>0
And T2.T1_ID=T1.ID

you'll see
Plan (T1 index (rdb$primary...), t2 index (rdb$foreign...)

Try the same with distinct and you'll see the same. Plan is defined
by any conditions on indexed columns. The only exception I know is
MAX, it requires descending index.

Best regards.