Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Strange Optimization in Oracle 8
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