db2 物化查询表MQT
查询语句是大致结构是这样:
with a1 as
(select
brand_id,
...
from
A
where
...
)
,b1 as
(select
...
from B
where ...
)
select
...
from
(
select
...
sum(...)
...
from
a1,
b1,
c
where
...
group by
...
) combine
order by
...
我拿以上语句直接去创建MQT后,直接select MQT表的cost是72,而按原语句去执行明显大于select MQT表,但是执行原语句为什么始终不用MQT呢?
一些简单的语句在库里可以使用MQT表,已经试验成功,所以不是数据库的原因