Sam Durai wrote:
Quote:
A simple update involving two small tables takes 45 minutes to
complete. I would appreciate if you can kindly help me to understand
the root cause of this slowness. Users would be happy if I can bring
the timing down to 5 minutes or less.
>
Environment:
DB2 V8.1 FP 12 / AIX 5.3
Both are non-partitioned tables..residing on a logically partitioned
database
>
Table1: STG.TB_FIN_BRANCH has 34,658 records
Table2: STG.TB_STATE has 108 records
>
Update SQL :
>
update stg.tb_fin_branch aa set (aa.branch_state) = ( select coalesce
state,' ') from stg.tb_fin_branch br left outer join stg.tb_state st
on r.branch_state = st.state where aa.branch_sk = br.branch_sk)
Let be translate this into English:
You have a table TB_FIN_BRANCH with a column BRANCH_SK.
Now you want to fill in an extra (new?) column BRANCH_STATE for _all_
rows in the table based on TB_STATE.
I think you are doing an extra join here that isn't needed:
UPDATE stg.tb_fin_branch aa
SET aa.branch_state = COALESCE((SELECT state
FROM stg.tb_fin_branch AS br
WHERE aa.branch_sk = br.branch_sk),
' ');
Cheers
Serge
--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab