A fix is available
APAR status
Closed as program error.
Error description
The cardinality used for costing of nested table expressions with "FETCH FIRST n ROWS" does not take into account the reduced rows. . SQLACCESSPATH SQLPERFORMANCE SQLFFNR
Local fix
N/A
Problem summary
**************************************************************** * USERS AFFECTED: All DB2 for z/OS users with queries * * containing "FETCH FIRST n ROWS ONLY". * **************************************************************** * PROBLEM DESCRIPTION: The estimated number of rows for * * SELECT statements with the FETCH FIRST * * n ROWS ONLY clause is not capped during * * the process of access path selection * * for the query at bind time. * * For example, * * * * SELECT cols * * FROM T1, * * (SELECT cols FROM T2 * * FETCH FIRST 100 ROWS ONLY) AS X * * WHERE T1.C1 = X.C1 * * * * ONECOMPROWS for table 'X' in query * * block 1 should be 100 rows. * * * * This may cause a wide variety of * * problems in the plan selection, * * including slow query performance. * **************************************************************** * RECOMMENDATION: * **************************************************************** The estimated number of rows for SELECT statements with the FETCH FIRST n ROWS ONLY clause is not capped during the process of access path selection for the query during bind time. For example, SELECT cols FROM T1, (SELECT cols FROM T2 FETCH FIRST 100 ROWS ONLY) AS X WHERE T1.C1 = X.C1 ONECOMPROWS for table 'X' in query block 1 should be 100 rows. Additional Keywords: SQLACCESSPATH SQLEXPLAIN SQLFFNR DSN_DETCOST_TABLE
Problem conclusion
The bind time code for selecting an access path is changed to cap the estimated number of rows coming out of the subquery block at n rows if "FETCH FIRST n ROWS ONLY" is specified on this subquery block. This will give DB2 a better chance of selecting a better access path for the given query.
Temporary fix
Comments
APAR Information
APAR number
PK60758
Reported component name
DB2 OS/390 & Z/
Reported component ID
5740XYR00
Reported release
910
Status
CLOSED PER
PE
NoPE
HIPER
NoHIPER
Special Attention
NoSpecatt
Submitted date
2008-02-08
Closed date
2008-03-24
Last modified date
2008-05-02
APAR is sysrouted FROM one or more of the following:
APAR is sysrouted TO one or more of the following:
UK34882
Modules/Macros
DSNXOGP
Fix information
Fixed component name
DB2 OS/390 & Z/
Fixed component ID
5740XYR00
Applicable component levels
R910 PSY UK34882
UP08/04/08 P F804
Fix is available
Select the PTF appropriate for your component level. You will be required to sign in. Distribution on physical media is not available in all countries.
[{"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Product":{"code":"SSEPEK","label":"Db2 for z\/OS"},"Component":"","ARM Category":[],"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"9.1","Edition":"","Line of Business":{"code":"LOB10","label":"Data and AI"}},{"Business Unit":{"code":"BU054","label":"Systems w\/TPS"},"Product":{"code":"SG19M","label":"APARs - z\/OS environment"},"Component":"","ARM Category":[],"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"9.1","Edition":"","Line of Business":{"code":"","label":""}}]
Document Information
Modified date:
02 May 2008