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 -> Really slow query .. is there a better approach??

Really slow query .. is there a better approach??

From: jobs <jobs_at_webdos.com>
Date: Sat, 15 Sep 2007 18:53:54 -0700
Message-ID: <1189907634.004116.310350@50g2000hsm.googlegroups.com>


select p.phone,p.account_number,o.amount from users_phones p, orders o
where p.account_number = o.account_number and p.status=1 and p.eci=0 and o.validation_date > sysdate-15
and p.btn=1 and o.status=1 and o.id =(select min(oo.id) from orders oo
where oo.ACCOUNT_NUMBER=p.account_number and oo.amount>0 and oo.validation_date > sysdate-15)

if I run the code up to the "and o.id" It selects 54 rows really fast.

The orders table should only have about 10 to 20 orders per Id. So why dos the addition of that min(oo.id) code significantly slow me down.

Is there a better approach.

Thanks in advance for any help or information! Received on Sat Sep 15 2007 - 20:53:54 CDT

Original text of this message

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