IBM Support

IC94371: MERGE STATEMENT WITH ONE MATCHING-CONDITION MIGHT RUN SLOWER

Subscribe

You can track all active APARs for this component.

APAR status

  • Closed as program error.

Error description

  • A MERGE statement might run slower if all the conditions below
    are met:
    
    1. There is only one matching-condition (WHEN clause).
    2. The modification-operation (THEN clause) is an UPDATE
    operation.
    3. The search-condition (ON clause) is join that involves an
    expression.
        The expression might not be seen as an expression at the ON
    clause
        but could derive from the operation below it (please see the
    example below.)
    4. There is no index on the join column from the target table.
    
    An example is:
    
    MERGE INTO <tgt-table> T
      USING (
        SELECT <expression> as C1, ...
        FROM    <src-table> S
        GROUP BY  <expression>
      ) ON S.C1 = T.<col>
    WHEN MATCHED
    THEN
    UPDATE SET ...
    
    If there is no index on column T.<col> and the join involves
    expressions, the join between S and T will choose a NLJOIN plan
    with a TBSCAN on T.
    
    This potential performance regression is observed when upgrade
    DB2 from previous releases or from version 9.7 Fix Pack 5 to
    version 9.7 Fix Pack 6 or later. Prior to version 9.7 Fix Pack
    6, an alternate access plan using MSJOIN could be chosen.
    

Local fix

  • Create a index on T.<col> to add an IXSCAN on T as an alternate
    choice for the NLJOIN between S and T.
    

Problem summary

  • ****************************************************************
    * USERS AFFECTED:                                              *
    * All Users                                                    *
    ****************************************************************
    * PROBLEM DESCRIPTION:                                         *
    * See Error Description                                        *
    ****************************************************************
    * RECOMMENDATION:                                              *
    * Upgrade to DB2 V97FP9 or high version                        *
    ****************************************************************
    

Problem conclusion

  • Fixed on DB2 V97FP9
    

Temporary fix

  • Create a index on T.<col> to add an IXSCAN on T as an alternate
    choice for the NLJOIN between S and T.
    

Comments

APAR Information

  • APAR number

    IC94371

  • 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

    2013-07-24

  • Closed date

    2013-12-16

  • Last modified date

    2013-12-16

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

  • 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



Document information

More support for: DB2 for Linux, UNIX and Windows

Software version: 9.7

Reference #: IC94371

Modified date: 16 December 2013