DB2 - Problem description
Problem IC71196 | Status: Closed |
DB2 QUERY OPTIMIZER MIGHT CHOOSE A NON-OPTIMAL ACCESS PLAN FOR QUERIES INVOLVING JOINS ON SKEWED DATA. | |
product: | |
DB2 FOR LUW / DB2FORLUW / 970 - DB2 | |
Problem description: | |
DB2 might be encountering this problem if the SQL statement is not performing optimally, one or more joins in the query are on columns with significant skew in one or both sides of the join, and neither column referenced in the join is unique, or close to unique. Under this condition, the DB2 Optimizer might underestimate the cardinality which might result in a less than optimal query access plan. To solve this problem, in most cases, a statistical view can be created on the join to provide the optimizer the appropriate information to address for the skew. This fix will improve the optimizer's cardinality estimation to make use of single table column distribution statistics to estimate the skew in the join, for each individual equality join predicate. The following is an example of a query with an equality join predicate that is eligible under these conditions: SELECT ... FROM ... T1, T2, ... WHERE ... T1.X=T2.X A statistical view will provide more accurate information as well as more flexibility in cases such as the following that will not be addressed with this improvement: 1. There are multiple columns involved in the join, and the columns are statistically correlated; 2. Joins involving non-equality predicates such as "T1.DATE >= T2.START_DATE AND T1.DATE <= T2.END_DATE"; 3. Local predicates are applied on either side of the join that correlates to the data in the join column such as "T1.X IN (x,y,z) AND T1.Y=T2.Y" | |
Problem Summary: | |
**************************************************************** * USERS AFFECTED: * * ALL * **************************************************************** * PROBLEM DESCRIPTION: * * See Error Description * **************************************************************** * RECOMMENDATION: * * Upgrade to version 9.7 Fix Pack 6 * **************************************************************** | |
Local Fix: | |
Create a statistical view for the affected join(s) to provide the optimizer the relevant information to account for the data skew. | |
available fix packs: | |
DB2 Version 9.7 Fix Pack 6 for Linux, UNIX, and Windows | |
Solution | |
Problem was first fixed in version 9.7 Fix Pack 6 | |
Workaround | |
See Local Fix | |
BUG-Tracking | |
forerunner : APAR is sysrouted TO one or more of the following: IC71258 follow-up : | |
Timestamps | |
Date - problem reported : Date - problem closed : Date - last modified : | 14.09.2010 14.06.2012 14.06.2012 |
Problem solved at the following versions (IBM BugInfos) | |
9.7.FP6 | |
Problem solved according to the fixlist(s) of the following version(s) | |
9.7.0.6 |