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 IC70922 Status: Closed

A RANGE JOIN PREDICATE JOINED TO A UNION ALL VIEW WITH A GROUP B Y CLAUSE
MAY PRODUCE A SUB-OPTIMAL PLAN.

product:
DB2 FOR LUW / DB2FORLUW / 970 - DB2
Problem description:
Db2 may not push down a range join to a Union All view into the 
tables of the Union All view.This would prevent Db2 to produce 
a sub-optimal plan. 
. 
The following conditions must be met in order to hit this proble 
m: 
. 
1)  There is a Group By clause on the table and the Union 
All view of the range join predicate. 
2)  Any column from the table in the range join predicate 
derives from an expression that is not a column. 
. 
For example: 
. 
create table br1(tranid integer, trandate date, amount decimal); 
create table br2(tranid integer, trandate date, amount decimal); 
create view ua as (select * from br1 union all select * from 
br2); 
. 
create table datedim(durid integer, startdate date, enddate 
date); 
. 
create view vdatedim(durid, startdate, enddate) 
as 
(select  durid, 
           case when month(startdate) = 3 then startdate + 1 day 
else startdate end startdate, 
            enddate 
 from     datedim 
); 
. 
select ua.trandate, count(tranid), sum(amount) 
from    ua, vdatedim 
where  ua.trandate between vdatedim.startdate and 
vdatedim.enddate 
group by ua.trandate 
; 
.
Problem Summary:
Db2 may not push down a range join to a Union All view into the 
 tables of the Union All view.This would prevent Db2 to produce 
 a sub-optimal plan. 
 . 
 The following conditions must be met in order to hit this 
proble 
 m: 
 . 
 1)  There is a Group By clause on the table and the Union 
 All view of the range join predicate. 
 2)  Any column from the table in the range join predicate 
 derives from an expression that is not a column. 
 . 
 For example: 
 . 
 create table br1(tranid integer, trandate date, amount 
decimal); 
 create table br2(tranid integer, trandate date, amount 
decimal); 
 create view ua as (select * from br1 union all select * from 
 br2); 
 . 
 create table datedim(durid integer, startdate date, enddate 
 date); 
 . 
 create view vdatedim(durid, startdate, enddate) 
 as 
 (select  durid, 
            case when month(startdate) = 3 then startdate + 1 
day 
 else startdate end startdate, 
             enddate 
  from     datedim 
 ); 
 . 
 select ua.trandate, count(tranid), sum(amount) 
 from    ua, vdatedim 
 where  ua.trandate between vdatedim.startdate and 
 vdatedim.enddate 
 group by ua.trandate 
; 
.
Local Fix:
available fix packs:
DB2 Version 9.7 Fix Pack 4 for Linux, UNIX, and Windows
DB2 Version 9.7 Fix Pack 5 for Linux, UNIX, and Windows
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
fixed >= v97 fpk4
Workaround
not known / see Local fix
Timestamps
Date  - problem reported    :
Date  - problem closed      :
Date  - last modified       :
02.09.2010
29.04.2011
29.04.2011
Problem solved at the following versions (IBM BugInfos)
9.7.FPk4
Problem solved according to the fixlist(s) of the following version(s)
9.7.0.4 FixList