DB2 - Problembeschreibung
Problem IC64027 | Status: Geschlossen |
JOIN BETWEEN TWO GROUPBY SUBQUERY MAY ABEND DB2 INSTANCE | |
Produkt: | |
DB2 FOR LUW / DB2FORLUW / 970 - DB2 | |
Problembeschreibung: | |
Query abends DB2 instance with StackTrace in trap file starting with pp__17sqlnq_qunqncchild sqlnq_unify_cstar sqlnr_gbelim_action One sample query is WITH gbsubq1 AS (SELECT c11, c12 FROM t1 GROUP BY c11, c12), gbsubq2 AS (SELECT DISTINCT c11, COUNT (*) AS count1, COUNT(CASE WHEN c12 = 20 THEN 1 ELSE 0 END) AS count2 FROM gbsubq1 GROUP BY c11) SELECT count1, count2 FROM gbsubq1, gbsubq2 where gbsubq1.c11 = gbsubq2.c11; No query will get into this problem unless it meets all the following conditions: 1. Query main block has an equivalent join predicate whose join keys are from two different group by sub-queries, i.e. gbsubq1 and gbsubq2 in the example. 2. gbsubq2 references gbsubq1. Also, the two join keys are derived from the common base table column. In this case, that predicate is "gbsubq1.c11 = gbsubq2.c11", and gbsubq1.c11 and gbsubq2.c11 are both derived from t1.c11. 3. gbsubq2 SELECT list contains more than one COUNT aggregates. One ore more COUNT aggregate has CASE expression operand. The main query block references to at least two gbsubq2's COUNT aggregates. 4. The SELECT of gbsubq2 has DISTINCT. | |
Problem-Zusammenfassung: | |
JOIN BETWEEN TWO GROUPBY SUBQUERY MAY ABEND DB2 INSTANCE | |
Local-Fix: | |
1. Get rid of "DISTINCT" from gbsubq2 in the sql statement. 2. Replace "COUNT(CASE WHEN c12 = 20 THEN 1 ELSE 0 END)" with "COUNT(*)" in the sql statement. The two workaround won't change query result. | |
verfügbare FixPacks: | |
DB2 Version 9.7 Fix Pack 1 for Linux, UNIX, and Windows | |
Lösung | |
First Fixed on DB2 V9.7 Fixpak 1. | |
Workaround | |
keiner bekannt / siehe Local-Fix | |
Weitere Daten | |
Datum - Problem gemeldet : Datum - Problem geschlossen : Datum - der letzten Änderung: | 22.10.2009 17.12.2009 17.12.2009 |
Problem behoben ab folgender Versionen (IBM BugInfos) | |
9.7. | |
Problem behoben lt. FixList in der Version | |
9.7.0.1 |