Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2003
    Posts
    2

    Unhappy Unanswered: How could the optimizer choose to use the MQT

    I had built a summary table as follow:

    db2 "create table db2inst1.thirdcube as (select a,b,c,sum(fact) as amount from db2inst1.fact1 group by cube(a,b,c) ) DATA INITIALLY DEFERRED REFRESH DEFERRED ENABLE QUERY OPTIMIZATION"
    db2 "refresh table db2inst1.thirdcube"
    db2 "RUNSTATS ON table db2inst1.thirdcube WITH DISTRIBUTION"

    But when I run a qurey:
    select a, sum(fact) from fact1 group by a

    The db2expln shows that the query still used the base table fact1 instead of the summary table.
    I also tried:
    SET CURRENT REFRESH AGE ANY
    SET CURRENT QUERY OPTIMIZATION 9
    and
    refresh immediate

    But it does not work.
    Any one of you would help me figure it out?

    Thanks a lot,

  2. #2
    Join Date
    May 2003
    Location
    USA
    Posts
    5,737
    Do you ask this same question on comp.databases.ibm-db2? Did you try the suggestion to use the GROUPING() function for each nullable column that is part of the cube in the MQT definition to uniquely identify the row in the cube representing the rollup by A?
    M. A. Feldman
    IBM Certified DBA on DB2 for Linux, UNIX, and Windows
    IBM Certified DBA on DB2 for z/OS and OS/390

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •