DB2 - Problem description
| Problem IT02856 | Status: Closed |
QUERY WITH A MIX OF EQUALITY AND RANGE PREDICATES IS NOT FULLY SIMPLIFIED | |
| product: | |
DB2 FOR LUW / DB2FORLUW / 970 - 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 Users * **************************************************************** * PROBLEM DESCRIPTION: * * See Error Description * **************************************************************** * RECOMMENDATION: * * Upgrade to fix pack 10 * **************************************************************** | |
| 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 | |
Problem fixed in fix pack 10 | |
| Workaround | |
not known / see Local fix | |
| Timestamps | |
Date - problem reported : Date - problem closed : Date - last modified : | 30.06.2014 05.03.2015 05.03.2015 |
| Problem solved at the following versions (IBM BugInfos) | |
| Problem solved according to the fixlist(s) of the following version(s) | |
| 9.7.0.10 |
|
| 9.7.0.11 |
|