Subject RE: [firebird-support] union and order by
Author Svein Erling Tysvær
>It looks simply replacing the like 'bd%' with starting with 'bd' will make it use the index as well. Will be
>simpler to do that in code than adding the between.

Does your statement actually use 'bd%' or a parameter? LIKE :MyParameter can never use an index since it doesn't know if the parameter starts with a constant or a wildcard. STARTING WITH on the other hand, can use an index. I'm uncertain whether old Firebird versions can use an index for LIKE <constant>, I would expect 1.5 to be able to use it, but it might be an optimization that came later (I used Fb 1.5 for many years without noticing such a problem, but I hardly ever used LIKE, and probably never when I hoped for an index to be used on that field).

HTH,
Set