This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Oracle/OAS and the fly likes Why my index is not used? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Products » Oracle/OAS
Bookmark "Why my index is not used?" Watch "Why my index is not used?" New topic
Author

Why my index is not used?

Bruce Jin
Ranch Hand

Joined: Sep 20, 2001
Posts: 666
These 2 queries take 23 seconds on Oracle:

(1) select invline from mrcmpower.bisales order by invline desc
(2) select invline from mrcmpower.bisales where invline >0 order by invline desc

They should be the same because all 2 million rows in the table have invline > 0.

Then I added index: create index mrcmpower.index2 on mrcmpower.bisales (invline desc)

Now query (1) still takes 23 seconds and query (2) only takes 0.01 second.

Why query (1) does not use the index?

Thanks


BJ - SCJP and SCWCD
We love Java programming. It is contagious, very cool, and lot of fun. - Peter Coad, Java Design

Crazy Bikes created by m-Power
Carol Enderlin
drifter
Ranch Hand

Joined: Oct 10, 2000
Posts: 1364
they should?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Why my index is not used?