Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: LIKE operator
A copy of this was sent to "Ralf" <r.geronimi_at_bigfoot.com>
(if that email address didn't require changing)
On Mon, 26 Oct 1998 19:36:48 +0100, you wrote:
>I have a very important question about LIKE operator in SQL with Oracle :
>
>the documentation say that
>"
>Pattern Matching on Indexed Columns When LIKE is used to search an indexed
>column for a pattern, Oracle can use the index to improve the statement's
>performance if the leading character in the pattern is not "%" or "_". In
>this case, Oracle can scan the index by this leading character. If the first
>character in the pattern is "%" or "_", the index cannot improve the query's
>performance because Oracle cannot scan the index.
>"
>
>But my request is like that :
>SELECT ... FROM ... WHERE ... x like Y
>,where x is a contant, and Y an indexed column of a table in the FROM part.
>Will Oracle use its index to improve performances ?
>
>----
>Raphael Geronimi
>
No it cannot. It must inspect each and every value of Y. It will not use the index to do this.
consider a table with values:
Y
select * from where 'CONSTANT' like Y;
has to look at each of the three rows to find that only %A% applies. No indexing can be used...
Thomas Kyte
tkyte_at_us.oracle.com
Oracle Government
Herndon VA
--
http://govt.us.oracle.com/ -- downloadable utilities
Anti-Anti Spam Msg: if you want an answer emailed to you, you have to make it easy to get email to you. Any bounced email will be treated the same way i treat SPAM-- I delete it. Received on Mon Oct 26 1998 - 12:40:08 CST