I've got a relatively simple update statement:
update sv_konginfo ki
set AnzDarl = 1
where kong_nr in (
select kong_nr
from sv_darlehen
group by kong_nr
having count (*) = 1);
which runs okay on its own (about 1 second for about 150.000 records).
However, if I truncate the table and then re-insert the records:
truncate table sv_konginfo;
insert into sv_konginfo (kong_nr)
select distinct kong_nr
from sv_darlehen;
the update statement runs very slow (more than a minute) working on exactly the same data.
What can I do to improve the performance in the second scenario? (We're using an Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit.)