Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Strange Optimization in Oracle 8

Re: Strange Optimization in Oracle 8

From: Noons <wizofoz2k_at_yahoo.com.au>
Date: Sun, 28 Sep 2003 09:30:53 +1000
Message-ID: <3f76236c$0$2471$afc38c87@news.optusnet.com.au>

"Ken Reily" <reil0037_at_umn.edu> wrote in message news:f0f32458.0309271340.4933c20f_at_posting.google.com...

> (name). Then, to find all names beginning with K, I use this query:
>
> SELECT name FROM Person WHERE substr(name,1,1) = 'K'
>
> This query does a full table scan! Shouldn't it use the index? The
> equivalent query:
>
> SELECT name FROM Person WHERE name LIKE 'K%'
>
> uses the index. Any thoughts???

Functions applied to columns in predicates disable index use. The first query has a better chance of using the index if you code it as:

SELECT name FROM Person WHERE name like 'K%'

-- 
Cheers
Nuno Souto
wizofoz2k_at_yahoo.com.au.nospam
Received on Sat Sep 27 2003 - 18:30:53 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US