Subject Re: [firebird-support] union and order by
Author Bart Smissaert
> Does your statement actually use 'bd%' or a parameter?

It uses 'bd%', so no parameters. Using the starting with will make it all
simple
as I can do that at source, so no need to programmatically alter a SQL.

RBS



On Mon, Jul 16, 2012 at 11:17 AM, Svein Erling Tysv�r <
svein.erling.tysvaer@...> wrote:

> **
>
>
> >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
>
>
>


[Non-text portions of this message have been removed]