Subject | Re: [firebird-support] Re: Question regarding index |
---|---|
Author | Ann Harrison |
Post date | 2011-09-12T16:48:49Z |
On Sun, Sep 11, 2011 at 9:22 PM, firebirdsql <firebirdsql@...> wrote:
which only the first and third were provided. Firebird creates a compound
index of the three fields in the order they're listed in the primary key
declaration. If they query provides values for all three fields (equality
matches for the first two and any indexable condition for the third),
Firebird can use the index for all of them. If the query provides only the
first and second, Firebird can use those two. If the query provides only
the first and third, Firebird can use only the first.
Good luck,
Ann
[Non-text portions of this message have been removed]
> So the order of the columns matter in the where clause filter.No, not at all. In the examples, the primary key was on three field, of
which only the first and third were provided. Firebird creates a compound
index of the three fields in the order they're listed in the primary key
declaration. If they query provides values for all three fields (equality
matches for the first two and any indexable condition for the third),
Firebird can use the index for all of them. If the query provides only the
first and second, Firebird can use those two. If the query provides only
the first and third, Firebird can use only the first.
> Doesn't the optimizer automatically rearrange the filter columns etc?Yes, but it can't supply a value when none is provided.
Good luck,
Ann
[Non-text portions of this message have been removed]