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

DB2 might produce a sub-optimal plan for query with group by over NULL
constant

product:
DB2 FOR LUW / DB2FORLUW / A50 - DB2
Problem description:
Queries containing NULL constant values as an argument to 
SUM/MIN/MAX aggregation function can experience poor performance 
when the tables are defined with the ORGANIZE BY COLUMN 
attribute. 
 
DB2 will improve the performance of queries with the following 
pattern: 
1) The query contains one or more of SUM/MAX/MIN aggregation 
functions 
2) The input to these functions is a NULL constant or another 
function that can be simplified to a NULL constant such as CASE 
expression. 
 
Example: 
Original query: 
select sum(null) 
     from ta 
 
 
Optimized statement will show an absence of Group By. 
SELECT 
  NULL 
FROM 
  (SELECT 
     $RID$ 
   FROM 
     (SELECT 
        $RID$ 
      FROM 
        TA AS Q1 
     ) AS Q2 
  ) AS Q3
Problem Summary:
**************************************************************** 
* USERS AFFECTED:                                              * 
* engn_sqnr                                                    * 
**************************************************************** 
* PROBLEM DESCRIPTION:                                         * 
* See Error Description                                        * 
**************************************************************** 
* RECOMMENDATION:                                              * 
* Upgrade to DB2 v10.5 fixpak 7.                               * 
****************************************************************
Local Fix:
Rewrite the query to remove the grouping function with NULL from 
the query and specifying NULL itself in the select list. 
Thus the example query will be: 
 
select null from ta;
Solution
First fixed in DB2 v10.5 fixpak 7.
Workaround
not known / see Local fix
Timestamps
Date  - problem reported    :
Date  - problem closed      :
Date  - last modified       :
07.08.2015
20.01.2016
20.01.2016
Problem solved at the following versions (IBM BugInfos)
Problem solved according to the fixlist(s) of the following version(s)
10.5.0.7 FixList