Subject Re: [firebird-support] Slow IN operator
Author Steve Wiser
Try using:

...
from table1 t1
where exists (
select field2
from table2 t2
where t1.field1 = t2.field2

Not sure why "in" is much slower, but we have switched to using exists
instead.

-steve

jasajona wrote:
> Hello,
>
> I use something like this:
> ...
> Where field1 in (select field2 from table2)
>
> table2 has about 50 records. Why does it so dramaticly slow down
> query, even if I write all these values without doing subselect.
>
> Next question. If subselect is constant (like in my example), how many
> times firebird executes it?
>
>
>
>
>
>
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
> Visit http://firebird.sourceforge.net and click the Resources item
> on the main (top) menu. Try Knowledgebase and FAQ links !
>
> Also search the knowledgebases at http://www.ibphoenix.com
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
> Yahoo! Groups Links
>
>
>
>
>
>
>
>
>
>