home clear 64x64
en blue 200x116 de orange 200x116 info letter User
suche 36x36
Neueste VersionenFixList
11.1.0.7 FixList
10.5.0.9 FixList
10.1.0.6 FixList
9.8.0.5 FixList
9.7.0.11 FixList
9.5.0.10 FixList
9.1.0.12 FixList
Haben Sie Probleme? - Kontaktieren Sie uns.
Kostenlos registrieren anmeldung-x26
Kontaktformular kontakt-x26

DB2 - Problembeschreibung

Problem IC61626 Status: Geschlossen

DB2 QUERY REWRITE MAY NOT COMPLETELY OPTIMIZE A QUERY CONTAINING A
REDUNDANT LOCAL OUTER JOIN PREDICATE

Produkt:
DB2 FOR LUW / DB2FORLUW / 970 - DB2
Problembeschreibung:
DB2 Query ReWrite (QRW) may not completely optimize a query 
containing a local predicate in the on clause of a left or right 
outer join (LOJ) from the row-preserving (RP) side. 
. 
This optimization may be overlooked if the following conditions 
are satisfied: 
- The producer of the RP side of the LOJ is a UNION or UNION ALL 
(UA) 
- The local predicate in the on clause is subsumed or made 
redundant by a local predicate in the RP side 
. 
An example scenario follows: 
CREATE TABLE T1 (C1 INT); 
CREATE TABLE T2 LIKE T1; 
CREATE TABLE T3 LIKE T1; 
CREATE TABLE T4 LIKE T1; 
. 
SELECT Q.C1 
FROM   (SELECT C1 FROM T2 
        UNION ALL 
        SELECT C1 FROM T3 
        UNION ALL 
        SELECT C1 FROM T4 
       ) AS Q (C1) 
       LEFT OUTER JOIN T1 
       ON (Q.C1 > 1         -- <-- P1 
           AND Q.C1 = T1.C1 -- <-- P2 
          ) 
WHERE  Q.C1 > 1;            -- <-- P3 -- makes P1 redundant
Problem-Zusammenfassung:
DB2 Query ReWrite (QRW) may not completely 
optimize a query 
containing a local predicate in the on clause 
of a left or right 
outer join (LOJ) from the row-preserving (RP) 
side. 
. 
This optimization may be overlooked if the 
following conditions 
are satisfied: 
- The producer of the RP side of the LOJ is a UNION or UNION ALL 
(UA) 
- The local predicate in the on clause is subsumed or made 
redundant by a local predicate in the RP side 
. 
An example scenario follows: 
CREATE TABLE T1 (C1 INT); 
CREATE TABLE T2 LIKE T1; 
CREATE TABLE T3 LIKE T1; 
CREATE TABLE T4 LIKE T1; 
. 
SELECT Q.C1 
FROM   (SELECT C1 FROM T2 
        UNION ALL 
        SELECT C1 FROM T3 
        UNION ALL 
        SELECT C1 FROM T4 
       ) AS Q (C1) 
       LEFT OUTER JOIN T1 
       ON (Q.C1 > 1         -- <-- P1 
           AND Q.C1 = T1.C1 -- <-- P2 
          ) 
WHERE  Q.C1 > 1;            -- <-- P3 -- makes P1 redundant
Local-Fix:
Manually alter the query by removing the redundant local 
predicate in the on clause of the outer join, e.g., for the 
query above, this may be done like so: 
. 
SELECT Q.C1 
FROM   (SELECT C1 FROM T2 
        UNION ALL 
        SELECT C1 FROM T3 
        UNION ALL 
        SELECT C1 FROM T4 
       ) AS Q (C1) 
       LEFT OUTER JOIN T1 
       ON (Q.C1 = T1.C1)    -- <-- P2 
WHERE  Q.C1 > 1;            -- <-- P3
verfügbare FixPacks:
DB2 Version 9.7 Fix Pack 1 for Linux, UNIX, and Windows
DB2 Version 9.7 Fix Pack 2 for Linux, UNIX, and Windows
DB2 Version 9.7 Fix Pack 3 for Linux, UNIX, and Windows
DB2 Version 9.7 Fix Pack 3a for Linux, UNIX, and Windows
DB2 Version 9.7 Fix Pack 4 for Linux, UNIX, and Windows
DB2 Version 9.7 Fix Pack 5 for Linux, UNIX, and Windows
DB2 Version 9.7 Fix Pack 7 for Linux, UNIX, and Windows
DB2 Version 9.7 Fix Pack 9a for Linux, UNIX, and Windows
DB2 Version 9.7 Fix Pack 6 for Linux, UNIX, and Windows
DB2 Version 9.7 Fix Pack 8 for Linux, UNIX, and Windows
DB2 Version 9.7 Fix Pack 9 for Linux, UNIX, and Windows
DB2 Version 9.7 Fix Pack 10 for Linux, UNIX, and Windows

Lösung
module engn_sqnr 
fixed >= v97 fpk1
Workaround
Manually alter the query by removing the redundant local 
predicate in the on clause of the outer join, e.g., for the 
query above, this may be done like so: 
. 
SELECT Q.C1 
FROM   (SELECT C1 FROM T2 
        UNION ALL 
        SELECT C1 FROM T3 
        UNION ALL 
        SELECT C1 FROM T4 
       ) AS Q (C1) 
       LEFT OUTER JOIN T1 
       ON (Q.C1 = T1.C1)    -- <-- P2 
WHERE  Q.C1 > 1;            -- <-- P3
Weitere Daten
Datum - Problem gemeldet    :
Datum - Problem geschlossen :
Datum - der letzten Änderung:
20.06.2009
11.02.2010
11.02.2010
Problem behoben ab folgender Versionen (IBM BugInfos)
9.7.FPk1
Problem behoben lt. FixList in der Version
9.7.0.1 FixList