Using an oracle DB, 11g r2, I need to write a pl/sql which updates one column in table A where the PK exists in table B, with commits ever ~50,00 rows.
3200000 rows are involved in the update, and table A has ~70 million rows total.
What is the most efficient way to do this?
Table A (has ~70 million rows, and ~100 columns. Only one needs to be updated):
CREATE TABLE ORD
(
ORDER_KEY NUMBER NOT NULL,
/* ~95 other columns */
ORDER_TYPE" NUMBER(10,0) /* col needing update */
)
Order key has an index.
Table B (contains the id's of the rows from table a which need the update):
CREATE TABLE GR_ORD (ORDER_KEY NUMBER NOT NULL)
Best Answer
Most efficient way to do the update is most likely not with PL/SQL, but with single SQL statement, for example:
or with merge:
You should be able to do ~3M update in a single transaction. I have run updates against table with 100+ columns at rate of 1M updates in 15 seconds (single thread in average server).