IBM Support

IT27908: THE PERFORMANCE CAN BE SUB-OPTIMAL WHEN MAX IS USED AS A LAST HEAD EXPRESSION IN A QUERY.

Subscribe to this APAR

By subscribing, you receive periodic emails alerting you to the status of the APAR, along with a link to the fix after it becomes available. You can track this item individually or track all items by product.

Notify me when this APAR changes.

Notify me when an APAR for this component changes.

 

APAR status

  • Closed as program error.

Error description

  • The query performance can be sub-optimal when it meets the
    following condition;
    
    1) It's a simple SELECT
    2) It has at lest 2 MIN or MAX aggregation.
    3) The MAX is the last head expression
    4) The alias is used instead of the real table name.
    
    For instance, to reproduce;
    
    CREATE TABLE TEST  ("TEST_ID" DECIMAL(14,0) ,"TEST_DT" DATE );
    CREATE ALIAS TEST_CURRENT FOR TABLE TEST;
    
    SELECT MAX(TEST_DT), MIN(TEST_DT) FROM TEST_CURRENT WITH UR
    SELECT MIN(TEST_DT), MAX(TEST_DT) FROM TEST_CURRENT WITH UR" -
    Slower than above
    
    When you run the queries above and get an execution plan, we
    will find that "IS NOT NULL" is added to MAX in the first query
    which is a good case, but not in the second query.
    

Local fix

  • Rewrite the query so that the MAX is first or use the table name
    instead of the Alias.
    

Problem summary

  • ****************************************************************
    * USERS AFFECTED:                                              *
    * All Db2 Users                                                *
    ****************************************************************
    * PROBLEM DESCRIPTION:                                         *
    * See Error Description                                        *
    ****************************************************************
    * RECOMMENDATION:                                              *
    * Upgrade to Db2 11.1.4.5 or later                             *
    ****************************************************************
    

Problem conclusion

  • First fixed in Db2 11.1.4.5
    

Temporary fix

Comments

APAR Information

  • APAR number

    IT27908

  • Reported component name

    DB2 FOR LUW

  • Reported component ID

    DB2FORLUW

  • Reported release

    B10

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt / Xsystem

  • Submitted date

    2019-01-29

  • Closed date

    2020-04-01

  • Last modified date

    2020-04-01

  • 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

[{"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Product":{"code":"SSEPGG","label":"Db2 for Linux, UNIX and Windows"},"Component":"","ARM Category":[],"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"11.1","Edition":"","Line of Business":{"code":"LOB10","label":"Data and AI"}}]

Document Information

Modified date:
29 January 2019