A simple update involving two small tables takes nearly 8 hours to complete. I would appreciate if you can kindly help me to understand the root cause of this slowness.
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 :
Quote:
|
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)
|
Both tables has matching indexes and are in good shape as per db2reorgchk
Quote:
Table DDL:
$ db2 describe table STG.TB_FIN_BRANCH
Column Type Type
name schema name Length Scale Nulls
------------------------------ --------- ------------------ -------- ----- ------
BRANCH_SK SYSIBM DECIMAL 10 0 No
BRANCH SYSIBM VARCHAR 6 0 No
BRANCH_ADDRESS SYSIBM VARCHAR 30 0 Yes
BRANCH_CITY SYSIBM VARCHAR 25 0 Yes
BRANCH_STATE SYSIBM VARCHAR 2 0 Yes
BRANCH_ZIPCODE SYSIBM VARCHAR 9 0 Yes
BRANCH_COUNTRY SYSIBM VARCHAR 2 0 Yes
CLOSED_DATE SYSIBM TIMESTAMP 10 0 Yes
CONTACT_SK SYSIBM DECIMAL 10 0 No
CONTACT_AGENCY SYSIBM VARCHAR 35 0 Yes
10 record(s) selected.
$ db2 describe indexes for table STG.TB_FIN_BRANCH show detail
Index Index Unique Number of
schema name rule columns Column names
------------------------------- ------------------ -------------- -------------- ------------------------------------------------------------
STG WMX1 D 2 +BRANCH_STATE+BRANCH_SK
STG WMX2 D 10 +CONTACT_SK+CONTACT_AGENCY+CLOSED_DATE+BRANCH_ZIPC ODE+BRANCH_CITY+BRANCH_ADDRESS+BRANCH+BRANCH_SK+BR ANCH_COUNTRY+BRANCH_STATE
Table 2 DDL:
$ db2 describe table STG.TB_STATE
Column Type Type
name schema name Length Scale Nulls
------------------------------ --------- ------------------ -------- ----- ------
COUNTRY SYSIBM VARCHAR 2 0 No
STATE SYSIBM VARCHAR 2 0 No
STATE_NAME SYSIBM VARCHAR 100 0 No
CTRY_STATE SYSIBM VARCHAR 100 0 No
STATE_ORDER SYSIBM DECIMAL 10 0 No
5 record(s) selected.
$ db2 describe indexes for table STG.TB_STATE show detail
Index Index Unique Number of
schema name rule columns Column names
------------------------------- ------------------ -------------- -------------- ------------------------------------------------------------
STG IX1 D 1 +STATE
1 record(s) selected.
|
I have attached the explain plan collected using db2exfmt for your reference