DB2 - Problem description
Problem IC76001 | Status: Closed |
A GENERATED COLUMN WHICH IS NOT USED IN THE SQL CAN BE REFERRED IN THE ACCESS PLAN AND MAY CAUSE A SUBOPTIMAL PLAN CHOICE. | |
product: | |
DB2 FOR LUW / DB2FORLUW / 950 - DB2 | |
Problem description: | |
When a generated column can be used to derive new predicates in an outer join, even it's not referenced in the optimized statement, the optimizer may still want to retrieve it, which may cause suboptimal plans. For example: Consider two tables that are outer joined as follows: create table t1(c1 char(10) not null, c2 char(20) not null, c3 char(10) not null, c2sub5 char(10) not null generated always as (substr(c2,1,5))); create unique index i1 on t1(c1, c2) include (c3); create table t2(c1 char(10), c2 char(20)); select t1.c3 from t2 left join t1 on (t1.c1=t2.c1 and t1.c2=t2.c2); In this case, c2sub5 can be used to generate a derived join predicate based on t1.c2=t2.c2. Even though a perfect index (i1) exists, the optimizer may still generate a TBSCAN or IXSCAN/FETCH plan in order to retrieve c2sub5. This can be worked around by including the unnecessary column (c2sub5) in the index definition: create unique index i1 on t1(c1, c2) include (c3, c2sub5); Note this only happens in outer joins. | |
Problem Summary: | |
**************************************************************** * USERS AFFECTED: * * ALL * **************************************************************** * PROBLEM DESCRIPTION: * * See Error description field for more information. * **************************************************************** * RECOMMENDATION: * * Upgrade to Version 9.5 FixPack 9. * **************************************************************** | |
Local Fix: | |
Include the generated column in the index definition. | |
available fix packs: | |
DB2 Version 9.5 Fix Pack 9 for Linux, UNIX, and Windows | |
Solution | |
Problem was first fixed in DB2 UDB Version 9.5 FixPack 9. | |
Workaround | |
not known / see Local fix | |
BUG-Tracking | |
forerunner : APAR is sysrouted TO one or more of the following: IC76373 follow-up : | |
Timestamps | |
Date - problem reported : Date - problem closed : Date - last modified : | 26.04.2011 22.03.2012 22.03.2012 |
Problem solved at the following versions (IBM BugInfos) | |
9.5.FP9 | |
Problem solved according to the fixlist(s) of the following version(s) | |
9.5.0.9 |