DB2 - Problem description
Problem IC71311 | Status: Closed |
RUNSTATS USING A STATISTICS PROFILE WITH OPTION "ON KEY COLUMNS"DIDN'T ACT AS EXPECTED FOR NEWLY CREATED OR DROPPED INDEXES | |
product: | |
DB2 FOR LUW / DB2FORLUW / 970 - DB2 | |
Problem description: | |
If a statistics profile is set having runstats option "ON KEY COLUMNS", runstats using the profile won't collect basic and/or distribution statistics for newly created indexes or remove basic and/or distribution statistics for newly dropped indexes. The problem can occur when the statistics profile contains "ON KEY COLUMNS" for basic and/or distribution statistics The root cause of the issue is, when an index is dropped or created, the existing statistics profile isn't maintained accordingly if the statistics profile has the runstats option "ON KEY COLUMNS" For example, the issue can be reproduced in two scenarios below. Scenario 1: db2 "create table myt1 (id smallint, name varchar(10))" //collect statistics and set profile with option "WITH DISTRIBUTION ON KEY COLUMNS" db2 "runstats on table db2inst1.myt1 WITH DISTRIBUTION ON KEY COLUMNS set profile" //check if any columns' distribution statistics have been collected. it should be nothing in this case as there is no index. db2 "select distinct substr(colname,1,10) colname from syscat.coldist where tabname='MYT1'" //create a new index db2 "create index myt_idx on myt1(id)" //runstats use profile db2 "runstats on table db2inst1.myt1 use profile" //check again if any columns' distribution statistics have been collected. it's supposed to have distribution statistics for the column "ID", however there is still nothing. db2 "select distinct substr(colname,1,10) colname from syscat.coldist where tabname='MYT1'" Scenario 2: db2 "create table myt1 (id smallint, name varchar(10))" //create an index db2 "create index myt_idx on myt1(id)" //collect statistics and set profile with option "WITH DISTRIBUTION ON KEY COLUMNS" db2 "runstats on table db2inst1.myt1 WITH DISTRIBUTION ON KEY COLUMNS set profile" //check if any columns' distribution statistics have been collected. The column "ID" should be there. db2 "select distinct substr(colname,1,10) colname from syscat.coldist where tabname='MYT1'" COLNAME ---------- ID 1 record(s) selected. //drop the index db2 "drop index myt_idx" //runstats use profile db2 "runstats on table db2inst1.myt1 use profile" //check again if any columns' distribution statistics have been collected. it's supposed that the existing distribution statistics for the index column "ID" should have been removed, however it's still there. db2 "select distinct substr(colname,1,10) colname from syscat.coldist where tabname='MYT1'" COLNAME ---------- ID 1 record(s) selected. | |
Problem Summary: | |
**************************************************************** * USERS AFFECTED: * * All * **************************************************************** * PROBLEM DESCRIPTION: * * same as "Error Description" * **************************************************************** * RECOMMENDATION: * * Upgrade to DB2 Version 9.7 Fix Pack 4 * **************************************************************** | |
Local Fix: | |
Refresh the statistics profile by running "RUNSTATS ... SET PROFILE ONLY" or "RUNSTATS ... SET PROFILE" after an index is dropped or created. | |
available fix packs: | |
DB2 Version 9.7 Fix Pack 4 for Linux, UNIX, and Windows | |
Solution | |
Problem was first fixed in Version 9.7 Fix Pack 4 | |
Workaround | |
same as "Local Fix". | |
Timestamps | |
Date - problem reported : Date - problem closed : Date - last modified : | 18.09.2010 02.05.2011 02.05.2011 |
Problem solved at the following versions (IBM BugInfos) | |
9.7.FP4 | |
Problem solved according to the fixlist(s) of the following version(s) | |
9.7.0.4 |