Java Mailing List Archive

http://www.dba.5341.com/

Home » Home (12/2007) » oracle l »

RE: expensive SQL

Mercadante, Thomas F

2006-03-10

Replies:

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@freelists.org [mailto:oracle-l-bounce@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

 

©2008 dba.5341.com - Jax Systems, LLC, U.S.A.