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,