IBM Support

IT02998: DB2 MIGHT NOT OPTIMIZE SQL QUERIES CONTAINING OUTER JOINS AND EXISTENTIAL SUBQUERIES

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • DB2 might not be able to fully optimize queries containing the
    following pattern leading to long execution times.
    Pattern conditions:
    1) The query contains one or more outer joins.
    2) The null producing side of the outer join is involved in a
    correlated predicate inside a subquery
    3) The subquery is of the form EXISTS or IN.
    4) The subquery is used in the context of a predicate with no
    complex expressions like OR, CASE, etc.
    
    eg.
    select * from t1 left join t2 on t1.c1 = t2.c1 where exists
    (select * from t3 where t2.c2 = t3.c2);
    select * from t1 left join t2 on t1.c1 = t2.c1 where t2.c2 in
    (select c2 from t3);
    

Local fix

  • Rewrite the query to convert the subquery into a DISTINCT inner
    join:
    
    select * from t1 left join t2 on t1.c1 = t2.c1 inner join
    (select distinct c2 from t3) on t2.c2 = t3.c2
    

Problem summary

  • ****************************************************************
    * USERS AFFECTED:                                              *
    * All DB2 9.7 users                                            *
    ****************************************************************
    * PROBLEM DESCRIPTION:                                         *
    * See problem description above.                               *
    ****************************************************************
    * RECOMMENDATION:                                              *
    * Upgrade to DB2 Version 9.7 Fix Pack 10 or higher.            *
    ****************************************************************
    

Problem conclusion

  • First fixed in DB2 Version 9.7 Fix Pack 10.
    

Temporary fix

Comments

APAR Information

  • APAR number

    IT02998

  • Reported component name

    DB2 FOR LUW

  • Reported component ID

    DB2FORLUW

  • Reported release

    970

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt

  • Submitted date

    2014-07-07

  • Closed date

    2014-10-22

  • Last modified date

    2014-10-22

  • APAR is sysrouted FROM one or more of the following:

  • APAR is sysrouted TO one or more of the following:

    IT03070 IT03072

Fix information

  • Fixed component name

    DB2 FOR LUW

  • Fixed component ID

    DB2FORLUW

Applicable component levels

  • R970 PSN

       UP

[{"Business Unit":{"code":"BU048","label":"IBM Software"},"Product":{"code":"SSEPGG","label":"DB2 for Linux, UNIX and Windows"},"Component":"","ARM Category":[],"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"9.7","Edition":"","Line of Business":{"code":"LOB10","label":"Data and AI"}}]

Document Information

Modified date:
22 October 2014