Subject | Re: [firebird-support] = , LIKE, CONTAINING |
---|---|
Author | Ivan Prenosil |
Post date | 2005-04-06T11:03:53Z |
> Will there be any differents in the plan if we are using either '=' or= and STARTING can use index if available.
> 'LIKE' or 'CONTAINING'?
> If there is, which one is the fastest?
> Or maybe it varies according to the condition?
LIKE can use index only if string literal not starting with wildcard is used, i.e.
these can use index:
myfield LIKE 'abc%'
myfield LIKE 'abc%xyz'
these can't:
myfield LIKE '%abc%'
myfield LIKE ?
CONTAINING never use index.
Note that CONTAINIG (unlike all other operators) is case-insensitive.
Also note that LIKE (unlike =) is sensitive to trailing spaces.
And do not foget that using index does not automatically mean
faster execution (e.g. low-selective queries like
"select * from tab where myfield starting 'a' "
are usually faster without index.)
Ivan
http://www.volny.cz/iprenosil/interbase/