IBM Support

IC70380: THE OPTIMIZER MIGHT CHOOSE A LESS-THAN-OPTIMAL QUERY ACCESS PLAN AFTER A RUNSTATS IS EXECUTED

Subscribe

You can track all active APARs for this component.

APAR status

  • Closed as program error.

Error description

  • To determine if you are encountering this problem, produce an
    EXPLAIN for the query and check for the following conditions:
    - there are multiple equality join predicates applied between
    the same two tables
    - the cardinality of the join is very small (a value less than 1
    is a strong indicator)
    - the join operation chosen is a NLJOIN when a HSJOIN/MSJOIN is
    more likely a better choice
    
    The following is a query with a join between two tables
    involving multiple join predicates:
    SELECT ...
    FROM ... T1, T2, ...
    WHERE ... T1.A=T2.A AND T1.B=T2.B AND T1.C=T2.C
    

Local fix

  • Collecting column group statistics on the columns involved in
    the join will usually solve the problem.  If column group
    statistics or an index with the appropriate key is already
    available, then you are likely to be encountering this issue.
    The following article provides more details on how column group
    statistics are used by the optimizer and how they could help in
    these scenarios:
    http://www.ibm.com/developerworks/data/library/techarticle/dm-06
    12kapoor/index.html
    

Problem summary

  • Problem Description:
    THE OPTIMIZER MIGHT CHOOSE A LESS-THAN-OPTIMAL QUERY ACCESS PLAN
    AFTER A RUNSTATS IS EXECUTED
    
    Problem Summary:
    To determine if you are encountering this problem, produce an
    
    EXPLAIN for the query and check for the following conditions:
    - there are multiple equality join predicates applied between
    the same two tables
    - the cardinality of the join is very small (a value less than 1
    is a strong indicator)
    - the join operation chosen is a NLJOIN when a HSJOIN/MSJOIN is
    more likely a better choice
    
    The following is a query with a join between two tables
    involving multiple join predicates:
    SELECT ...
    FROM ... T1, T2, ...
    WHERE ... T1.A=T2.A AND T1.B=T2.B AND T1.C=T2.C
    

Problem conclusion

  • Problem is first fixed in Version 9.7 Fixpack 4
    

Temporary fix

  • Collecting column group statistics on the columns involved in
    
    the join will usually solve the problem.  If column group
    statistics or an index with the appropriate key is already
    available, then you are likely to be encountering this issue.
    The following article provides more details on how column group
    statistics are used by the optimizer and how they could help in
    these scenarios:
    http://www.ibm.com/developerworks/data/library/techarticle/dm-06
    12kapoor/index.html
    

Comments

APAR Information

  • APAR number

    IC70380

  • 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-08-04

  • Closed date

    2011-04-29

  • Last modified date

    2011-04-29

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

    IZ81406

  • 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 PSY

       UP



Document information

More support for: DB2 for Linux, UNIX and Windows

Software version: 9.7

Reference #: IC70380

Modified date: 29 April 2011