Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Update performance on a 38 million records table

856186Dec 6 2011 — edited Dec 7 2011
Hi all,

I´m trying to create a script to update a table that have around 38 million records. That table isn´t partitioned and I just have to update one CHAR(1 byte) field and set it to 'N'.
The Database is 10g r2 running on a Unix TRU64.

The script I create have a LOOP on a CURSOR that Bulk 200.000 records by pass and do a FORALL to update the table by ROWID.
The problem is, on the performances tests that method took about 20 minutes to update 1 million rows and should take about 13 hours to update all table.

My question is: Is that any way to improve the performance?

The Script:
--------------------------------------------------------------------------------
DECLARE
CURSOR C1
IS
SELECT ROWID
FROM RTG.TCLIENTE_RTG;

type rowidtab is table of rowid;
d_rowid rowidtab;
v_char char(1) := 'N';

BEGIN

OPEN C1;

LOOP

FETCH C1
BULK COLLECT INTO d_rowid LIMIT 200000;

FORALL i IN d_rowid.FIRST..d_rowid.LAST
UPDATE RTG.TCLIENTE_RTG
SET CLI_VALID_IND = v_char
WHERE ROWID = d_rowid(i);

COMMIT;
EXIT WHEN C1%NOTFOUND;
END LOOP;
CLOSE C1;
END;
/
------------------------------------------------------------------------------

Kind Regards,

Fabio
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 3 2012
Added on Dec 6 2011
13 comments
4,632 views