Subject RE: [firebird-support] Firebird 2.1.3 optimizer in does not use index - Email found in subject
Author Leyne, Sean
> create unique index IDX_T11 on T1 (S1);
> create unique index IDX_T12 on T2 (S2);
>
> b) Sample queries and their plans:
>
> This query (extremely simplified) uses no Index:
>
> select t1.s1 from t1 left join t2 on t1.s1=t2.s1
>
> PLAN JOIN (T1 NATURAL,T2 NATURAL)

You don't have an index on the T2.S1 columns, so there is no way for the engine to do anything other than a Natural JOIN



>
> If the logic of the join (which will deliver of course the wrong result) is
> changed, the index ist used:
>
> select t1.s1 from t1 right join t2 on t1.s1=t2.s1
>
> PLAN JOIN (T2 NATURAL,T1 INDEX (IDX_T11))

The 2 SQLs are not equivalent.


Sean