Subject Re: [ib-support] query optimizing
Author Ann W. Harrison
At 10:12 PM 12/5/2000 +1100, Helen Borrie wrote:

>Yes, it should be sub-second. I think the problem is in the CONTAINING
>clause - I always get confused about this but I *think* containing doesn't
>use the index (or maybe CONTAINING does use it and STARTING WITH
>doesn't).

Helen - the way to remember is that the index can only be used from the
beginning of the key - just as a compound index will be used if you supply
values for the first columns defined, a partial string match will use an
index iff the value is at the beginning of the key. Containing makes no
such assumption. Starting with does - that's why it exists. Like can go
either way. If the query includes a literal comparison value (Bram%) then
it will use an index. If the query passes a variable, or if the literal
comparison starts with a wild card, the index can not be used.


Regards,

Ann
www.ibphoenix.com
We have answers.