Subject Re: [firebird-support] Computed index
Author Ann Harrison
On Wed, Oct 9, 2013 at 7:29 AM, Tim Ward <tdw@...> wrote:
I've got a query containing

... WHERE ...  (MYFIELD in (1,3,4,5,7,8,9,11,12,13))

which runs horribly slowly, because (quite reasonably) the query
optimiser gives up on that, even though it's got an index on MYFIELD.

It might make sense to ask for 
               MYFIELD between 1 and 13 and
               MYFIELD+0 in (1,3,4,5,7,8,9,11,12,13)

Not of course if all the MYFIELDS are between 1 and 13 and most have
significant fractional parts.  Firebird indexes are pretty good at ranges -
not great,but OK - and a range means coming down from the top of the
index once and reading across rather than coming down from the top
once per value as it must do with the IN portion.

Good luck,

Ann