Subject | Re: usage of = and between in queries |
---|---|
Author | Adam |
Post date | 2005-12-28T07:21:59Z |
--- In firebird-support@yahoogroups.com, Vahan Yoghoudjian
<vahan@p...> wrote:
additional hit to a cached index so it wont be any slower than what
you are doing at the client side. Between is a lot better than IN
(where possible)
eg
where somefield between 1 and 5
is a lot more efficient than
where somefield in (1,2,3,4,5)
Adam
<vahan@p...> wrote:
>if I
> Hello all
>
> First of all I want to wish you all the best for the new year....
>
> Is there any differences in the usage of indexes if in the query
> sayconditions
>
> Method1: where (CODE = 'ABCD')
> Method2: where (CODE between 'ABCD' and 'ABCD')
>
> The main reason for this is that I have functions that write
> of some queries at run time according to the selected values fromtwo Lookup
> combos by the user (FROM and TO). So far in these functions I am notcourse
> checking if those two values are equal, whatever the values are (of
> only if TO >= FROM) the second method is used to write the condition...adjust
> If in thise case the first method has better performance I will
> the functions in order to generate this method if both values are equalThat will be fine. Even if FB doesn't internally optimise it, it is an
>
additional hit to a cached index so it wont be any slower than what
you are doing at the client side. Between is a lot better than IN
(where possible)
eg
where somefield between 1 and 5
is a lot more efficient than
where somefield in (1,2,3,4,5)
Adam