I need to update a huge table in oracle that contains ~40*10^6 records. The number of rows that will be modified will be approximately 10^7. The query that determines the rows that will be updated is complex and involves joins. It takes 30 mins just to identify the id of rows that will be updated.
Select p.some_id from
(select some_id, col2,col3 from t1 where col2='someVulue' and col3 ='someValue') p
inner join (select some_id from t2 where t2.col3='someValue') q
on p.some_id=q.some_id
Now in order to do the update i need to add another join or use the IN statement which will make things even worse.
Is there a way to parallelize this ? Or to do a batch update (update 25*10^4 rows each time)? is there a way to tell oracle to only update first n rows ? then n->2n, then 2n->3n ... ?
The script will be ran on a production environment so table rebuild is not an alternative.
The update consists of setting a boolean column to true.(if this can help)