dbTalk Databases Forums  

slow query for MIN function

comp.databases.oracle.misc comp.databases.oracle.misc


Discuss slow query for MIN function in the comp.databases.oracle.misc forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Kevin
 
Posts: n/a

Default slow query for MIN function - 07-16-2003 , 07:35 AM






I am trying to run the following query:

Select min(tran_date)
from Sales
WHERE (Card1 = '123' OR Card2 = '123' OR Card3 = '123' )
and product = 1

It takes several minutes to return the tran_date. However, if I do a
"Select *" and add in the where clause "and tran_date = "07-Jul-2003"
it starts returning rows almost immediately.

I have an index on

3 composite indexes:
Card1 + tran_date + product
Card2 + tran_date + product
Card3 + tran_date + product

The explain plan on the min(tran_date) query and the select * both use
all three indexes.


Why does the min(tran_date) query run so slowly?

Thanks

Kevin

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.