|Subject||Re: [firebird-support] Speed difference between = and LIKE|
> I would assume that he has someapplication code that generates SQL on the fly
Exactly right and I understand now that (and also why) there is no benefit
here to replace the starting with 'abcd%' with = 'abcde'
> Martijn Tonies wrote:
>> > OK, so I suppose the main thing here is that using LIKE doesn't
>> prevent an
>> > index being used.
>> > Maybe I didn't explain clear enough.
>> > Given the situation that in field1 all records starting with abcd are
>> > abcde
>> > is there then any advantage to do
>> > field1 = 'abcde' compared to doing field1 starting with 'abcd' ?
>> Well, one advantage might be that you can never know for future data
>> if STARTING WITH 'abcd' returns only 'abcde' data ;-)
>> They are different statements, use the one that is appropriate.
> Considering what RBS is asking, I would assume that he has some
> application code that generates SQL on the fly, and he's asking if he'd
> gain anything by treating the = case differently than then general
> starting with case, if he knows (somehow) they are equivalent in regards
> to what they would return with the current data.
> If that's what he's actually asking, then I would assume that the answer
> is no, because the same index will be used in any case. Although the
> actual comparison is probably slightly faster for =, that difference
> would be minute compared to the effects of indexing.
> Kjell Rilbe
> DataDIA AB
> E-post: kjell@...
> Telefon: 08-761 06 55
> Mobil: 0733-44 24 64