Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> slow query for MIN function

slow query for MIN function

From: Kevin <kevin.zahn_at_usbank.com>
Date: 16 Jul 2003 05:35:16 -0700
Message-ID: <ea1e2fb3.0307160435.2f36d30c@posting.google.com>


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 Received on Wed Jul 16 2003 - 07:35:16 CDT

Original text of this message

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