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

QUERY WITH A MIX OF EQUALITY AND RANGE PREDICATES IS NOT FULLY SIMPLIFIED

product:
DB2 FOR LUW / DB2FORLUW / A10 - DB2
Problem description:
Complex query is not fully simplified in situation when: 
 
- there is a check constraint on a specified column of the 
underlying table: 
 
ALTER TABLE CON1 
    ADD CONSTRAINT CON1 CHECK 
        (COL1 <= 201212 ) 
    ENFORCED 
    ENABLE QUERY OPTIMIZATION; 
 
 
- there is a mix of equality and range predicates in the various 
OR sub terms on the column involved in the check constraint. 
 
Query snippet: 
 
... 
(TAB1.COL1) BETWEEN 201301 AND 201309 AND TAB1.COL2 = 1 ) 
OR 
(TAB1.COL1 = 201301 AND TAB1.COL2 = 2 ) 
OR 
(TAB1.COL1 = 201309 AND TAB1.COL2 = 3 ) 
... 
 
This query is not fully simplified.
Problem Summary:
**************************************************************** 
* USERS AFFECTED:                                              * 
* ALL                                                          * 
**************************************************************** 
* PROBLEM DESCRIPTION:                                         * 
* See Error Description                                        * 
**************************************************************** 
* RECOMMENDATION:                                              * 
* Upgrade to DB2 10.1 Fix Pack 5                               * 
****************************************************************
Local Fix:
Change equality predicates to range predicates 
 
Snippet: 
 
... 
(TAB1.COL1) BETWEEN 201301 AND 201309 AND TAB1.COL2 = 1 ) 
OR 
(TAB1.COL1 = 201301 AND TAB1.COL2 = 2 ) 
OR 
(TAB1.COL1 = 201309 AND TAB1.COL2 = 3 ) 
... 
 
can be changed to: 
 
... 
(TAB1.COL1) BETWEEN 201301 AND 201309 AND TAB1.COL2 = 1 ) 
OR 
(TAB1.COL1 >= 201301 AND TAB1.COL1 < 201302 AND TAB1.COL2 = 2 ) 
OR 
(TAB1.COL1 >= 201309 AND TAB1.COL1 < 201310 AND TAB1.COL2 = 3 ) 
...
Solution
First fixed in DB2 10.1 Fix Pack 5
Workaround
not known / see Local fix
Timestamps
Date  - problem reported    :
Date  - problem closed      :
Date  - last modified       :
30.06.2014
17.02.2017
17.02.2017
Problem solved at the following versions (IBM BugInfos)
Problem solved according to the fixlist(s) of the following version(s)
10.1.0.5 FixList