Subject | Re: [firebird-support] Re: Firebird 2.1.x Indexing |
---|---|
Author | Dmitry Yemanov |
Post date | 2008-09-19T03:25:37Z |
Helen Borrie wrote:
it does make sense to use an index there. With multiple values, the
situation becomes trickier, as the total cost of multiple index scans
increases. Modern FB versions may stop using indices at some number of
IN member values and prefer the natural scan instead.
Dmitry
>Well, since the latter predicate is actually treated as aColumn = 'a',
> Actually, although the optimizer has undergone a lot of changes since Fb 1.5 to make sense of "unsmart" SQL, I think this is still true of IN() when used in the context that the caution refers to...i.e.
>
> ...where aColumn in ('a', 'b') will use an index
> but
> ......where aColumn in ('a') will not.
it does make sense to use an index there. With multiple values, the
situation becomes trickier, as the total cost of multiple index scans
increases. Modern FB versions may stop using indices at some number of
IN member values and prefer the natural scan instead.
Dmitry