Subject Re: Why does this query take forever in FB?!?!
Author Alexander V.Nevsky
--- In firebird-support@yahoogroups.com, "Arno Brinkman"
<firebird@a...> wrote:
> > Can someone explain why FB performs the sub-select for each row in the
> main
> > select even if the sub-select is not correlated and will always
return the
> > same resultset ?
>
> Internally the IN is converted to the same as a EXISTS function :
>
> FieldX IN (SELECT FieldY FROM TableA)
>
> becomes :
>
> EXISTS(SELECT FieldY FROM TableA WHERE FieldY = FieldX)
>
> Changing this has been planned for a future version.

Arno, Yaffil team tried to change behaviour of not correlated
sub-queries and IIRC after loooong struggle against induced bugs
achieved some success. Since Yaffil code is now available to you...

Best regards,
Alexander.