DB2 - Problem description
Problem IC63668 | Status: Closed |
INCORRECT RESULTS WHEN ORDERED COLUMN GROUP OR PREDICATE CAN BE USED AS INDEX KEYS | |
product: | |
DB2 FOR LUW / DB2FORLUW / 970 - DB2 | |
Problem description: | |
The DB2 query optimizer can apply ordered column group OR predicates as index start/stop key predicates for more efficient access. For example the following predicate (a1>1) or (a1=1 and a2>2) or (a1=1 and a2=2 and a3>=3) defines a column group (a1, a2, a3) and the inclusive condition on the key values (1, 2, 3). So if there is an index (a1 asc, a2 asc, a3 asc), then the optimizer can apply the composite inclusive key above for better filtering and minimal data read from the index. Under certain cases, when there are other predicates applicable on a subset of the key columns, you may encounter incorrect results. For example, the following set of predicates includes a join between tables A and B that applies to the first 2 key columns: a1=b1 AND a2=b2 AND ((a1>1) or (a1=1 and a2>2) or (a1=1 and a2=2 and a3>=3)) If a nested loop join (NLJOIN) operation is chosen with A on the inner, you may experience incorrect results. | |
Problem Summary: | |
The DB2 query optimizer can apply ordered column group OR predicates as index start/stop key predicates for more efficient access. For example the following predicate (a1>1) or (a1=1 and a2>2) or (a1=1 and a2=2 and a3>=3) defines a column group (a1, a2, a3) and the inclusive condition on the key values (1, 2, 3). So if there is an index (a1 asc, a2 asc, a3 asc), then the optimizer can apply the composite inclusive key above for better filtering and minimal data read from the index. Under certain cases, when there are other predicates applicable on a subset of the key columns, you may encounter incorrect results. For example, the following set of predicates includes a join between tables A and B that applies to the first 2 key columns: a1=b1 AND a2=b2 AND ((a1>1) or (a1=1 and a2>2) or (a1=1 and a2=2 and a3>=3)) If a nested loop join (NLJOIN) operation is chosen with A on the inner, you may experience incorrect results. | |
Local Fix: | |
Optimization profiles may be used to change the join operation or reverse the order of the join to avoid an access plan that leads to the incorrect results. | |
available fix packs: | |
DB2 Version 9.7 Fix Pack 1 for Linux, UNIX, and Windows | |
Solution | |
apar: ic63668 module: engn_sqno fixed >= v97 fpk1 | |
Workaround | |
Optimization profiles may be used to change the join operation or reverse the order of the join to avoid an access plan that leads to the incorrect results. | |
Timestamps | |
Date - problem reported : Date - problem closed : Date - last modified : | 08.10.2009 02.12.2009 02.12.2009 |
Problem solved at the following versions (IBM BugInfos) | |
9.7.FPk1 | |
Problem solved according to the fixlist(s) of the following version(s) | |
9.7.0.1 |