I have a table called objectos with around 64GB of data (or 404 000 000 lines of data) on my oracle database.
I’m trying to tune this pl/sql script:
declare
cursor c is
select DISTINCT a.object_name, a.object_id, a.dia
from objectos a;
begin
for r in c loop
update objectos
set object_name=r.object_name||object_id, object_id=r.object_id*2
where object_id=r.object_id+3
and dia=r.dia;
end loop;
close c;
end;
/
commit;
the cursor, because of the distinct, collects around 73000 lines and the select does a full table scan while the update does a range scan with a composite index for the columns object_id and dia (the index was created because of the where clauses in the update)
while tying to run the script the top wait event is db file sequential read caused by the update statement resulting in a high value of user IO wait time.
Currently it takes so long to run the script that i never finished run it once.
How can i reduce this user io wait time? What else can be done to tune this Pl/Sql script.