DB2 - Problem description
| Problem IC98604 | Status: Closed |
INCORRECT RESULT SET MIGHT BE RETURNED FOR A SQL STATEMENT REQUIRING A TRUNCATED SORT OPERATION | |
| product: | |
DB2 FOR LUW / DB2FORLUW / 970 - DB2 | |
| Problem description: | |
This issue was introduced by the fix for APAR IC93275 and only
affects version 9.7 Fix Pack 9 and 9a.
The problem can occur for a SQL statement that contains an ORDER
BY and FETCH FIRST N ROWS clause, where N > 1, and the optimizer
produces a query execution plan containing a truncated SORT
operation with an input estimated cardinality of exactly 0.
This problem is most likely to occur if statistics are collected
on an empty table and not updated after more than one row is
inserted into the table.
You can identify the problem by collecting an EXPLAIN of the
query and identifying there is a SORT operator with an input
cardinality of 0 such as:
0
TBSCAN
( 2)
...
|
0
SORT
( 3)
...
|
0
NLJOIN
( 4)
...
and the operator details shows it is truncated, with NUMROWS set
to 1:
3) SORT : (Sort)
...
Arguments:
---------
...
NUMROWS : (Estimated number of rows)
1
...
TRUNCSRT: (Truncated sort (for Fetch First n Rows Only))
TRUE | |
| Problem Summary: | |
**************************************************************** * USERS AFFECTED: * * only version 9.7 fix pack 9 is impacted * **************************************************************** * PROBLEM DESCRIPTION: * * See Error Description * **************************************************************** * RECOMMENDATION: * * upgrade to version 9.7 fix pack 10 * **************************************************************** | |
| Local Fix: | |
If your affected statement references a table with a cardinality statistic of 0, collect updated statistics on the table. | |
| Solution | |
First fixed in version 9.7 fix pack 10 | |
| Workaround | |
not known / see Local fix | |
| Timestamps | |
Date - problem reported : Date - problem closed : Date - last modified : | 08.01.2014 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 |
|