Subject Re: [firebird-support] Re: Subset query
Author Martijn Tonies
Hi,

> > No, I cannot unless you tell me what you're trying to do.
>
> Sure, here we go...
>
> I'm trying to do:
>
> select
> *
> from
> TABLENAME
> where
> (INDEXEDFIELD1 > '8.3.2006 00:00:00' and INDEXEDFIELD1 < '8.3.2006
> 00:10:00') and INDEXEDFIELD2 < '8.3.2006 00:00:00'
>
> Both where-fields are indexed, but the problem is that the first
> where-predicate is done very quickly due to short condition range,
> it's just 10 mins. But the second one is very long, cuz it's going
> through the whole db. So i'm trying select the first subset via the
> first where-predicate and than apply the second where predicate on
> the selected subset.

What about a combined index on both fields?

Martijn Tonies
Database Workbench - tool for InterBase, Firebird, MySQL, Oracle & MS SQL
Server
Upscene Productions
http://www.upscene.com
My thoughts:
http://blog.upscene.com/martijn/
Database development questions? Check the forum!
http://www.databasedevelopmentforum.com