Troubleshooting
Problem
The RUNSTATS utility can collect two types of distribution statistics: quantile statistics and frequent value statistics. Quantile statistics provide information about how data values are distributed in relation to other values. Frequent value statistics provide information about a column and the data value with the highest number of duplicates, the value with the second highest number of duplicates, etc. When you collect distribution statistics on columns containing string data with a common prefix of more than 32 bytes, the statistics can be inaccurate as a result of design limitations in the RUNSTATS utility. If you compile a query with equality or range predicates on this column, this inaccuracy can result in a sub-optimal query execution plan. Example: In the following example, table T1 contains a column of type CHAR(40) with the following data: C1 ---------------------------------------- test.test.test.test.test.test.value1 test.test.test.test.test.test.value2 test.test.test.test.test.test.value3 test.test.test.test.test.test.value3 test.test.test.test.test.test.value3 where the first 35 bytes are the same in each value. If you collect distribution statistics on this column, you will see the following data in the SYSSTAT.COLDIST catalog view COLVALUE VALCOUNT TYPE SEQNO ---------------------------------------- -------------------- ---- ------ 'test.test.test.test.test.test.val' 5 F 1 'test.test.test.test.test.test.val' 0 Q 1 'test.test.test.test.test.test.val' 5 Q 2 and for a query referencing the column in a predicate, such as SELECT C1 FROM T1 WHERE C1 < 'test.test.test.test.test.test.value2' the optimizer will estimate all rows in the table will be returned, which can be confirmed by collecting an EXPLAIN of the query.
Log InLog in to view more of this document
Was this topic helpful?
Document Information
Modified date:
12 June 2026
UID
swg21668238