Subject | Re: [firebird-support] Optimisation Question |
---|---|
Author | Martijn Tonies |
Post date | 2004-08-06T07:58:52Z |
Hi,
Arno might explain why ;-)
With regards,
Martijn Tonies
Database Workbench - developer tool for InterBase, Firebird, MySQL & MS SQL
Server.
Upscene Productions
http://www.upscene.com
> With firebird, why is that this:The optimizer could rewrite the first query into the second, but doesn't.
>
> select TABLE_A.field1
> from TABLE_A
> where TABLE_A.joinfield not in (select distinct joinfield from TABLE_B)
>
> runs much much much slower than
>
> SELECT TABLE_A.field1
> from TABLE_A
> inner JOIN TABLE_A on TABLE_A.joinfield = TABLE_B.joinfield
>
> which is lightning quick.
Arno might explain why ;-)
>What I think is happening is that the subBecause this is on the list for future improvements.
> query is being run for every row in the outer query, hence making it
> slow. But if that is true, why does it not just run the subquery once
> and then apply the results?
With regards,
Martijn Tonies
Database Workbench - developer tool for InterBase, Firebird, MySQL & MS SQL
Server.
Upscene Productions
http://www.upscene.com