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 |