IBM Support

IC71516: DB2 QUERY OPTIMIZER MIGHT NOT ELIMINATE OUTER JOIN WHEN AN ALWAYS FALSE PREDICATE IS APPLIED IN THE ON CLAUSE

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • The rewrite phase of the DB2 query optimizer might not eliminate
    an outer join when an always false predicate is applied in the
    on clause.  The following query is a simple example of such a
    scenario:
    
    select t2.a from t1 left outer join t2 on 1=0;
    
    You can identify whether there are outer joins with false
    predicates in the optimized form of the SQL statement by using
    the EXPLAIN tool and examine the "Optimized Statement" for
    always false predicates such as "1=0".  This fix will eliminate
    the redundant outer join, resulting in improved query execution
    performance.
    

Local fix

  • You can manually rewrite the outer join to a single table access
    of the row preserving side of the join.
    

Problem summary

  • ****************************************************************
    * USERS AFFECTED:                                              *
    * ALL                                                          *
    ****************************************************************
    * PROBLEM DESCRIPTION:                                         *
    * The rewrite phase of the DB2 query optimizer might not       *
    * eliminate                                                    *
    * an outer join when an always false predicate is applied in   *
    * the                                                          *
    * on clause.  The following query is an example of such a      *
    * scenario:                                                    *
    *                                                              *
    *                                                              *
    * select t2.a from t1 left outer join t2 on 1=0;               *
    *                                                              *
    *                                                              *
    *                                                              *
    * You can identify whether there are outer joins with false    *
    * predicates in the optimized form of the SQL statement by     *
    * using                                                        *
    * the EXPLAIN tool and examine the "Optimized Statement" for   *
    *                                                              *
    * always false predicates such as "1=0".  This fix will        *
    * eliminate                                                    *
    * the redundant outer join, resulting in improved query        *
    * execution                                                    *
    * performance.                                                 *
    ****************************************************************
    * RECOMMENDATION:                                              *
    * Upgrade to DB2 Version 9.7 Fix Pack 4                        *
    ****************************************************************
    

Problem conclusion

  • Problem was first fixed in Version 9.7 Fix Pack 4
    

Temporary fix

  • See Local Fix.
    

Comments

APAR Information

  • APAR number

    IC71516

  • 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

    2010-09-28

  • Closed date

    2011-04-28

  • Last modified date

    2011-04-28

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

    IC68711

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

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:
28 April 2011