home clear 64x64
en blue 200x116 de orange 200x116 info letter User
suche 36x36
Latest versionsfixlist
11.1.0.7 FixList
10.5.0.9 FixList
10.1.0.6 FixList
9.8.0.5 FixList
9.7.0.11 FixList
9.5.0.10 FixList
9.1.0.12 FixList
Have problems? - contact us.
Register for free anmeldung-x26
Contact form kontakt-x26

DB2 - Problem description

Problem IC80816 Status: Closed

REPLICATED MQT NOT MATCHED FOR INSERT-FROM-SELECT WHEN SELECT QUERIES UNION
ALL VIEW WITH EXISTS PREDICATE

product:
DB2 FOR LUW / DB2FORLUW / 970 - DB2
Problem description:
A replicated MQT is not matched for an insert-from-select. In 
the explain plan, EXP0060W is reported for the replicated MQT. 
 
Some necessary conditions to hit this problem are: 
1. It's an INSERT statement. 
2. The INSERT statement source subquery has an EXISTS predicate 
that references a base table with an MQT created on top. 
3. The INSERT statement source subquery queries a UNION ALL 
view, and the EXISTS predicate is applied on that UNION ALL 
view. 
4. The UNION ALL has non-deterministic or side-effect 
expression, such as RAND() in example below. 
 
Example: 
 
create table dim1 ( col1 int not null, col2 int); 
create table dim2 ( col1 int not null, col2 int); 
 
create table fact_1 ( col1 int, col2 int, col3 int, col4 int, 
col5 int ) DISTRIBUTE BY HASH("COL1") ; 
create table fact_2 ( col1 int, col2 int, col3 int, col4 int, 
col5 int ) DISTRIBUTE BY HASH("COL1") ; 
 
create view fact_all as ( 
select * from ( 
select fact_1.* from fact_1, dim2 where fact_1.col1 = dim2.col1 
union all 
select fact_2.* from fact_2, dim2 where fact_2.col1 = dim2.col1 
) 
where CASE WHEN 1 = 0 THEN RAND () ELSE 1 END = 1); 
 
create table dim1_rep as ( select col1 from dim1 ) data 
initially deferred refresh deferred replicated; 
refresh table dim1_rep; 
set current refresh age any; 
 
create table tab2 (tmp_col int); 
 
 
 
For the following INSERT statement, dim1_rep is not matched. 
EXP0060W is caught in db2exfmt plan. 
 
insert into tab2 
select count(*) 
from fact_all f 
where exists (select 1 from dim1 d1 where d1.col1 = f.col1);
Problem Summary:
**************************************************************** 
* USERS AFFECTED:                                              * 
* ALL                                                          * 
**************************************************************** 
* PROBLEM DESCRIPTION:                                         * 
* See Error Description                                        * 
**************************************************************** 
* RECOMMENDATION:                                              * 
* Update to Version 9.7 Fix Pack 6                             * 
****************************************************************
Local Fix:
N/A
available fix packs:
DB2 Version 9.7 Fix Pack 6 for Linux, UNIX, and Windows
DB2 Version 9.7 Fix Pack 7 for Linux, UNIX, and Windows
DB2 Version 9.7 Fix Pack 8 for Linux, UNIX, and Windows
DB2 Version 9.7 Fix Pack 9 for Linux, UNIX, and Windows
DB2 Version 9.7 Fix Pack 9a for Linux, UNIX, and Windows
DB2 Version 9.7 Fix Pack 10 for Linux, UNIX, and Windows

Solution
Problem was first fixed in Version 9.7 Fix Pack 6
Workaround
not known / see Local fix
BUG-Tracking
forerunner  : APAR is sysrouted TO one or more of the following: IC84357 
follow-up : 
Timestamps
Date  - problem reported    :
Date  - problem closed      :
Date  - last modified       :
13.01.2012
02.08.2012
02.08.2012
Problem solved at the following versions (IBM BugInfos)
9.7.FP6
Problem solved according to the fixlist(s) of the following version(s)
9.7.0.6 FixList