DB2 - Problem description
Problem IC96746 | Status: Closed |
QUERY CONTAINING DUPLICATE BRANCHES MIGHT CAUSE PERFORMANCE DEGRADATION | |
product: | |
DB2 FOR LUW / DB2FORLUW / A50 - DB2 | |
Problem description: | |
DB2 has a component called Query ReWrite (QRW) which rewrites the query to improve query performance. One of the optimizations done is to find common expressions and tables and combine them to save on processing and I/O costs. Under rare scenarios, this can prevent some subsequent optimizations from making progress and cause performance degradation. eg. CREATE VIEW v1 AS SELECT t3.* FROM t3 INNER JOIN (SELECT c1 FROM t5 WHERE t5.c1=APPLICATION_ID() and c2 > 0) tmp ON tmp.c1 = t3.c1; ALTER VIEW v1 ENABLE QUERY OPTIMIZATION; with cte1 as ( select t1.* from t4, t1 left join (t2 join v1 on t2.c1 = v1.c1) on t1.c2 = t2.c2 and t1.c1 is null where t4.c1 = t1.c1), cte2 as ( select t1.* from t1 left join (t2 join v1 on t2.c1 = v1.c1) on t1.c2 = t2.c2 and t1.c1 is null) select o.cnt old_cnt, n.cnt new_cnt, o.cnt - n.cnt diff from (select count(1) cnt from cte1) o join (select count(1) cnt from cte2) n on 1=1; | |
Problem Summary: | |
**************************************************************** * USERS AFFECTED: * * ALL * **************************************************************** * PROBLEM DESCRIPTION: * * See Problem Description above. * **************************************************************** * RECOMMENDATION: * * Upgrade to DB2 Version 10.5 Fix Pack 4. * **************************************************************** | |
Local Fix: | |
db2set DB2COMPOPT=8716421 and restart instance | |
available fix packs: | |
DB2 Cancun Release 10.5.0.4 (also known as Fix Pack 4) for Linux, UNIX, and Windows | |
Solution | |
First fixed in DB2 Version 10.5 Fix Pack 4. | |
Workaround | |
not known / see Local fix | |
Timestamps | |
Date - problem reported : Date - problem closed : Date - last modified : | 09.10.2013 09.09.2014 09.09.2014 |
Problem solved at the following versions (IBM BugInfos) | |
Problem solved according to the fixlist(s) of the following version(s) | |
10.5.0.4 |