RE: a quick SQL performance question - rethinked

Hi Andrey,
If the volume of rows is not too great, you can use a technique I've used. Retrieve the rowids and store them in a PL/SQL table as you process them. At the end of the processing loop, use a forall loop to delete the rows using the PL/SQL table. I know a 2000 row PL/SQL table should be no problem. I'm not really sure if a 20000 row PL/SQL table presents a performance or memory problem. If it does, you could periodically issue the forall delete loop within the main processing loop.
HTH
Kevin Kennedy
First Point Energy Corporation

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 ?

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 ~

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).
--

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).
--

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 - 16:11:01 CDT