Subject | Re: [firebird-support] Best index for BETWEEN? |
---|---|
Author | Dmitry Yemanov |
Post date | 2008-10-15T18:44:26Z |
Ann W. Harrison wrote:
Dmitry
>Absolutely correct.
> That query decomposes in the compiler into :something >= field1 and
> :something <= field2. You might think that a compound index would
> let you apply both predicates, but it doesn't (or at least it didn't
> when I was paying attention). The scan of an index has to be
> continuous - it can't skip over intermediate entries. If you have
> a compound index, Firebird will use only the first element in the
> index.
>
> So, subject to testing which should be pretty easy, I'd say two
> ascending indexes, one for each field.
Dmitry