DB2 - Problem description
Problem IC69061 | Status: Closed |
UNEXPECTED RESULTS FOR A QUERY THAT CONTAINS MULTIPLE DISTINCT'S AND REGISTRY SETTING FOR ENHANCED_MULTIPLE_DISTINCT IS ENABLED. | |
product: | |
DB2 FOR LUW / DB2FORLUW / 950 - DB2 | |
Problem description: | |
Incorrect results for a query that contains multiple distinct's and registry setting for ENHANCED_MULTIPLE_DISTINCT is turned on. . Description: If the following conditions are true: a) The DB2 instance is configured with DPF (multiple partitions) and the registry variable DB2_EXTENDED_OPTIMIZATION is set to ENHANCED_MULTIPLE_DISTINCT. b) A query is run that contains multiple distinct operations (see example) c) The query has predicates that need to be evaluated without an index. That is, in order to qualify or disqualify the row during predicate evaluation, it has to fetch the row and read the columns to compare the predicate rather than reading just the index (A sargable predicate). Then the query may return incorrect results. For example: select sum(distinct col2), avg(distinct col3), sum(distinct col4) from test where col5.data = 'abcde' group by col1; The wrong results is that even rows that should be disqualified based on the predicate col5.data = 'abcde', are still included in the query incorrectly. Thus, any sums or averages that are performed on the data may have extra data used in those aggregate operations. | |
Problem Summary: | |
Incorrect results for a query that contains multiple distinct's and registry setting for ENHANCED_MULTIPLE_DISTINCT is turned on. . Description: If the following conditions are true: a) The DB2 instance is configured with DPF (multiple partitions) and the registry variable DB2_EXTENDED_OPTIMIZATION is set to ENHANCED_MULTIPLE_DISTINCT. b) A query is run that contains multiple distinct operations (see example) c) The query has predicates that need to be evaluated without an index. That is, in order to qualify or disqualify the row during predicate evaluation, it has to fetch the row and read the columns to compare the predicate rather than reading just the index (A sargable predicate). Then the query may return incorrect results. For example: select sum(distinct col2), avg(distinct col3), sum(distinct col4) from test where col5.data = 'abcde' group by col1; The wrong results is that even rows that should be disqualified based on the predicate col5.data = 'abcde', are still included in the query incorrectly. Thus, any sums or averages that are performed on the data may have extra data used in those aggregate operations. | |
Local Fix: | |
If all of the local predicates can be resolved by doing an index scan as start/stop key predicates, (and not as sargable predicates), then this is a possible workaround to the problem. | |
Solution | |
apar IC69061 fixed >= v95 fpk7 | |
Workaround | |
If all of the local predicates can be resolved by doing an index scan as start/stop key predicates, (and not as sargable predicates), then this is a possible workaround to the problem. | |
Timestamps | |
Date - problem reported : Date - problem closed : Date - last modified : | 07.06.2010 20.12.2010 20.12.2010 |
Problem solved at the following versions (IBM BugInfos) | |
9.5.FPk7 | |
Problem solved according to the fixlist(s) of the following version(s) |