Help me to improve my query performance
this PL/SQL block takes around 4 minutes to execute
but i want to improve this query performance because it must finish with in seconds
if you have any idea to improve the performance of query,help me
This is my PL\SQL block
declare
Type table_id is table of number index by binary_integer;
v_id table_id;
begin
select elp_id bulk collect into v_id from table1 where sl_id=1500;
forall i in v_id.First..v_id.Last
update table2 set cost=cost+4 where elp_id=v_id(i);
commit;
end;
/
Here table1 having around 1,50,00,000(one and half crore) records
and table2 having around 2,00,000(two lakhs) records
select * from table1 where sl_id=1500;
elp_id sl_id
------- ------
1 1500
124 1500
203 1500
404 1500
1,25,245 records selected
select * from table2 ;
elp_id elp_name cost
------- ---------- ------
1 elp1 58
2 elp2 675
3 elp3 75
4 elp4 8
1,89,345 records selected
Here am not doing anything other then select and update.
i created index for elp_id(table1), elp_id(table2), sl_id(table1)
Thanks in advance for your thoughts,
Mani