Subject | Re: [firebird-support] Re: Why does this query take forever in FB?!?! |
---|---|
Author | Arno Brinkman |
Post date | 2004-05-07T09:29:25Z |
Hi,
FieldX IN (SELECT FieldY FROM TableA)
becomes :
EXISTS(SELECT FieldY FROM TableA WHERE FieldY = FieldX)
Changing this has been planned for a future version.
Regards,
Arno Brinkman
ABVisie
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Firebird open source database (based on IB-OE) with many SQL-99 features :
http://www.firebirdsql.org
http://www.firebirdsql.info
http://www.fingerbird.de/
http://www.comunidade-firebird.org/
Support list for Interbase and Firebird users :
firebird-support@yahoogroups.com
Nederlandse firebird nieuwsgroep :
news://newsgroups.firebirdsql.info
> > Raymond, let me answer in descending order.main
> > Why. Because FB serves IN (Select ...) scanning table in main select
> > and performing subquery. Seemingly, MS SQL perform subselect once and
> > perhaps use indices on main table if it is possible.
>
> Can someone explain why FB performs the sub-select for each row in the
> select even if the sub-select is not correlated and will always return theInternally the IN is converted to the same as a EXISTS function :
> same resultset ?
FieldX IN (SELECT FieldY FROM TableA)
becomes :
EXISTS(SELECT FieldY FROM TableA WHERE FieldY = FieldX)
Changing this has been planned for a future version.
Regards,
Arno Brinkman
ABVisie
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Firebird open source database (based on IB-OE) with many SQL-99 features :
http://www.firebirdsql.org
http://www.firebirdsql.info
http://www.fingerbird.de/
http://www.comunidade-firebird.org/
Support list for Interbase and Firebird users :
firebird-support@yahoogroups.com
Nederlandse firebird nieuwsgroep :
news://newsgroups.firebirdsql.info