Subject Re: [firebird-support] Re: Firebird 2.1.x Indexing
Author Dmitry Yemanov
Helen Borrie wrote:
>
> 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.

Well, since the latter predicate is actually treated as aColumn = 'a',
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