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

Home -> Community -> Usenet -> c.d.o.server -> Large set-based UPDATE

Large set-based UPDATE

From: Paul <f1fteen_at_hotmail.com>
Date: 12 Feb 2003 04:02:13 -0800
Message-ID: <7b7286ec.0302120402.3a3818c8@posting.google.com>


Hi all,

I am reviewing an Oracle stored procedure (BULK_UPDATE) that makes a large set-based update to a large table (ACCOUNTS, 5 million rows).

The problem we are encountering with this is that, because the UPDATE statement applies changes to a large number of rows at a time to the ACCOUNTS table (around 150,000), a web layer that also allows updates to this table is being regularly locked out for an unacceptable length of time.

To summarise the code:

An UPDATE statement is constructed within a stored procedure and executed using EXECUTE IMMEDIATE

This UPDATE statement affects around 150,000 rows of a 5,000,000 row table

I was thinking a possible solution to this is to break the 150,000 row set based update into 150,000 updates to single rows by processing them through a cursor. I would then COMMIT within the cursor every 1000 rows.

Is this a good way to go?

Am I right in thinking that only 1000 rows at a time will be locked using this method?

Is this likely to be much slower given that I am now updating 1 row at a time through a cursor?

All help is gratefully received.

Paul. Received on Wed Feb 12 2003 - 06:02:13 CST

Original text of this message

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