Subject | Re: [firebird-support] Optimisation Question |
---|---|
Author | Martijn Tonies |
Post date | 2004-08-06T08:24:46Z |
> > > With firebird, why is that this:TABLE_B)
> > >
> > > select TABLE_A.field1
> > > from TABLE_A
> > > where TABLE_A.joinfield not in (select distinct joinfield from
> > >doesn't.
> > > 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.
> >
> > The optimizer could rewrite the first query into the second, but
> > Arno might explain why ;-)I didn't look at it too long, but it they return the same results...
>
> Well, certainly in this case they are complete different queries?
> Would not be good if engine would rewrite query1 into query2 ;-)
But, it seems they don't :-)
With regards,
Martijn Tonies
Database Workbench - developer tool for InterBase, Firebird, MySQL & MS SQL
Server.
Upscene Productions
http://www.upscene.com