Subject Re: [firebird-support] 20 minute query in v 2.0 and 2.1
Author Arno Brinkman
Hi,

> We have a query that is fast in the FB 2.0 RC version, but in 2.0 and
> 2.1 takes 20 minutes. Essentially it deletes all records from a table
> in a master detail relationship.
> something like delete from detailTable where not exists (select distict
> masterTable.ID from masterTable where mastertableID = detailTable.FK)

The DISTINCT will cause that the sub-select is first executed fully and sorted afterwards and that
for every record in detailTable. I don't see the use of the DISTINCT function in a EXISTS predicate
thus i would remove that one and see what speed is then.

Regards,
Arno Brinkman
ABVisie

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
General database development support:
http://www.databasedevelopmentforum.com

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 Firebird and Interbase users :
firebird-support@yahoogroups.com

Nederlandse firebird nieuwsgroep :
news://newsgroups.firebirdsql.info