Subject Re: [firebird-support] union and order by
Author Bart Smissaert
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.


On 7/16/12, Bart Smissaert <bart.smissaert@...> wrote:
> Well, it is simple, with the union and with the added between it will
> use the index on that field, but with the simple or construction it
> won't.
> Looks like an omission in the planning code.
> On 7/16/12, Svein Erling Tysvær <svein.erling.tysvaer@...>
> wrote:
>>>Have tested and the difference is still enormous, some factor 10.
>>>As predicted the added between is slightly quicker than the union
>>> construction and thanks for that tip. This is in
>>>fact quite useful for me as currently I have to convert a OR SQL in code
>>> (VB) to the UNION and as you can imagine
>>>that can be quite tricky, particularly if there is an order by. So, I
>>> will
>>> change this code now to add the between
>>>instead and that will be a lot simpler.
>> It would be interesting to see the PLANs with the OR and UNION (and some
>> information about the chosen indexes). I simply cannot remember anything
>> like this with Fb 1.5.
>> Set