Merge Statement
548617Jul 14 2009 — edited Jul 20 2009Hi All,
I am working on history load from one database to another. As a part of it, I am running this merge statement. Not sure why it is taking too much time....
AU_TEMP
Bus_dt
gl_ac_nbr
ctc_nbr
act_bal
adj_bal
lst_Actvty_dt
AU_KEY
AU_ID
au_ty_id
unq_id_in_src_sys
crt_ts
lst_updt_ts
crt_run_id
lst_updt_run_id
I altered both the tables to have parallel and no logging feature..
merge /*+ append parallel(t,4)*/ ay_key auk
using au_temp t
on (t.gl_ac_nbr||t.ctc_nbr=auk.unq_id_in_src_sys)
when matched then
update set
auk.crt_ts=bus_dt,
auk.crt_run_id=200904
when not matched then
insert values (au_seq.nextval, 4, t.gl_ac||t.ctc_nbr,t.bus_dt,t.bus_dt,200904,200904);
There are no indexes or constraints on any of these tables. AU_KEY has aroung 4.2 millions rows and AU_TEMP also has more around 4.2 millions. I am seeing if the record from AU_TEMP is already present in AU_KEY just update the flelds CRT_TS and CRT_RUN_ID. If no match is found , I am inserting a new record into the AU_KEY table.
But the following merge statement is taking more than 1.25hrs and is still running.
Any idea/hints to troubleshoot or enhance the performance is greatly appreciated.
Thanks
Hari