DB2 - Problem description
| Problem IC98157 | Status: Closed |
DB2 OPTIMIZER MAY USE FREQUENCY VALCOUNT IN SYSSTAT.COLDIST INCORRECTLY AND GIVE SUB-OPTIMIAL ACCESS PLAN. | |
| product: | |
DB2 FOR LUW / DB2FORLUW / 970 - DB2 | |
| Problem description: | |
Under rare circumstances, DB2 optimizer may use frequency
VALCOUNT of a COLVALUE that doesn't match with the value in a
query. The problem happens on CHAR or VARCHAR data type columns
only.
For example,
1. In TAB1, value "0A00000005" appears in 1000 rows, and others
values appear in 1 row only.
db2 "select count(*),c1 from tab1 group by c1"
1 C1
----------- ----------
1 0000000009
1 0A00000000
1000 0A00000005
1 0A00000019
1 0A00000123
1 0A99900999
1 0B99990099
2. SYSSTAT.COLDIST has valid data, and frequency VALCOUNT of
"0A00000005" is 1000.
select substr(colvalue, 1, 30) colvalue, valcount
from sysstat.coldist
where colname = 'C1' and tabname ='TAB1' and
tabschema = '<SCHEMA>' and TYPE = 'F'
COLVALUE VALCOUNT
------------------------------ --------------------
'0A00000005' 1000
- -1
- -1
- -1
- -1
3. For the following query, optimizer incorrectly uses frequency
VALCOUNT of "0A00000005" for "c1='0A00000019'" predicate and
estimate 1000 returned rows.
select * from tab1 where c1='0A00000019';
Rows
RETURN
( 1)
Cost
I/O
|
1000
DTQ
( 2)
0.850451
0
|
1000
IXSCAN
( 3)
0.502298
0
|
1006
INDEX: SHULIN
TAB1_IDX1
Q1 | |
| Problem Summary: | |
**************************************************************** * USERS AFFECTED: * * All users * **************************************************************** * PROBLEM DESCRIPTION: * * See Error Description * **************************************************************** * RECOMMENDATION: * * Upgrade to DB2 version 9.7 fixpack 10 * **************************************************************** | |
| Local Fix: | |
statistical views can be used to work around the issue. | |
| Solution | |
Problem was first fixed in DB2 version 9.7 fixpack 10 | |
| Workaround | |
not known / see Local fix | |
| BUG-Tracking | |
forerunner : APAR is sysrouted TO one or more of the following: IC98769 IC98771 follow-up : | |
| Timestamps | |
Date - problem reported : Date - problem closed : Date - last modified : | 05.12.2013 10.11.2014 10.11.2014 |
| Problem solved at the following versions (IBM BugInfos) | |
9.7.FP10 | |
| Problem solved according to the fixlist(s) of the following version(s) | |
| 9.7.0.10 |
|