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 -> Strange Optimization in Oracle 8

Strange Optimization in Oracle 8

From: Ken Reily <reil0037_at_umn.edu>
Date: 27 Sep 2003 14:40:39 -0700
Message-ID: <f0f32458.0309271340.4933c20f@posting.google.com>

I am getting (what I think are) strange results from the optimizer on the Oracle server that I am using. I'll try and simplify the problem for posting here. I have a table, Person, containing columns id and name (again, very simplified). I CREATE INDEX Person_name ON Person (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??? Received on Sat Sep 27 2003 - 16:40:39 CDT

Original text of this message

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