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: a quick SQL performance question - rethinked

Re: a quick SQL performance question - rethinked

From: <Rajesh.Rao_at_jpmchase.com>
Date: Thu, 18 Jul 2002 12:59:09 -0800
Message-ID: <F001.0049BF4F.20020718125909@fatcity.com>

Andrey,

Instead of explicitly using 'where rowid = ', why not consider the use 'for update of' and 'where current of'?

Raj

                                                                                                                        
                    Andrey Bronfin                                                                                      
                    <andreyb_at_elrontel        To:     Multiple recipients of list ORACLE-L <ORACLE-L_at_fatcity.com>        
                    esoft.com>               cc:                                                                        
                    Sent by:                 Subject:     a quick SQL performance question - rethinked                  
                    root_at_fatcity.com                                                                                    
                                                                                                                        
                                                                                                                        
                    July 18, 2002                                                                                       
                    03:35 PM                                                                                            
                    Please respond to                                                                                   
                    ORACLE-L                                                                                            
                                                                                                                        
                                                                                                                        




Dear gurus !
I apologize for wasting your time.
I have had a second thought and realized that option (2) is not feasible, simply because i might "miss" some records, i.e. delete the records that are
inserted into MYTAB DURING the execution of the cursor. I.e. , time will pass between the opening of the cursor (i.e. execution of the cursor's SELECT statement) and between the delete outside the cursor. Meanwhile , new records will get inserted , which are still unprocessed by the cursor's business logic.....
So , i must ensure that i delete only the "processed" records , i.e. i must delete inside the cursor's loop.
Right ?

-----Original Message-----
Sent: Thu, July 18, 2002 8:39 PM
To: Multiple recipients of list ORACLE-L

Dear all !
I've got a cursor , which selects approximately 25% of records in a table
(the total number of records in that table is typically 2 to 20 thousands).
For each record ,fetched in that cursor, i need to do some processing , and then delete that record.
Now, what's faster:
1) Add the rowid to the fields selected inside the cursor, and issue "delete
from MYTAB where rowid = ...." , for each record inside the cursor. or
2) Leave the cursor intact, and just issue one delete statement afterwards, which will delete all the records , fetched by the cursor.

This operation is executed every couple of seconds, so i want to maximally optimize it .
Cheers.
I'd very much appreciate a prompt responce. Thanks a lot ~

DBAndrey

--
Please see the official ORACLE-L FAQ: http://www.orafaq.com
--
Author: Andrey Bronfin
  INET: andreyb_at_elrontelesoft.com

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L

(or the name of mailing list you want to be removed from). You may
also send the HELP command for other information (like subscribing). -- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: Andrey Bronfin INET: andreyb_at_elrontelesoft.com Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051 San Diego, California -- Public Internet access / Mailing Lists -------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from). You may
also send the HELP command for other information (like subscribing). -- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: INET: Rajesh.Rao_at_jpmchase.com Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051 San Diego, California -- Public Internet access / Mailing Lists -------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from). You may
also send the HELP command for other information (like subscribing).
Received on Thu Jul 18 2002 - 15:59:09 CDT

Original text of this message

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