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

Home -> Community -> Mailing Lists -> Oracle-L -> RE: expensive SQL

RE: expensive SQL

From: Mercadante, Thomas F (LABOR) <Thomas.Mercadante_at_labor.state.ny.us>
Date: Fri, 10 Mar 2006 07:58:07 -0500
Message-ID: <ABB9D76E187C5146AB5683F5A07336FF681046@EXCNYSM0A1AJ.nysemail.nyenet>


BN,  

We can only guess what the sql is supposed to accomplish. Is the programmer trying to get the latest record where server <>='cas1' by using rowed? If so, then this sql is not valid (think of records being deleted and new records being added - they will reuse a lower value rowid).  

There are a lot of other ways to accomplish what (I think) he is trying to do:  

select * from

 (select * from max_update

      Where server <> 'cas1'

       Order by (some column to determine the most recent record))

Where rownum < 2  

Good Luck!  

Tom  


From: oracle-l-bounce_at_freelists.org
[mailto:oracle-l-bounce_at_freelists.org] On Behalf Of BN Sent: Thursday, March 09, 2006 6:50 PM
To: Oracle-L Freelists
Subject: expensive SQL  

Greetings  

I see the following SQL from the Developer,  

select * from max_update where rowid in
(select max(rowid) from vrcdba.max_update group by request_id ) and request_id not in (select request_id from max_update where server ='cas1');    

Takes for ever  

What is he tryig to to do  

Appreciate your help

Regards & thanks  

--
http://www.freelists.org/webpage/oracle-l
Received on Fri Mar 10 2006 - 06:58:07 CST

Original text of this message

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