If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > How could the optimizer choose to use the MQT

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-22-03, 22:45
byliang byliang is offline
Registered User
 
Join Date: Dec 2003
Posts: 2
Unhappy 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,
Reply With Quote
  #2 (permalink)  
Old 12-22-03, 23:17
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,196
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
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On