Subject Re: perf WHERE IN (SUBQUERY)
Author Adam
--- In firebird-support@yahoogroups.com, "legrand_legrand_63"
<grand.brun.63@...> wrote:
>
> Here is a simple test case:
>
> select * from a
> where a.id in (select b.id from b where l ='a') ;
>
> gives:
> PLAN (B INDEX (B_ID)) PLAN (A NATURAL)
>
> Would it be possible to access A with index A_ID ?
> like in:
>
> select * from a
> where a.id in (1,2)
>
> PLAN (A INDEX (A_ID, A_ID))
>
> Regards
> PAscal

If you had an index on b.l and you changed it to an inner join, you
would probably get that.

select a.*
from a
join b on (a.id = b.aid)
where b.l = 'a'

Adam