为提高效率,提问时请提供以下信息,问题描述清晰可优先响应。
【DM版本】: DM8
【操作系统】:Kylin Linux Advanced Server V10 (Lance)
【CPU】: 32核
【问题描述】*:
备注:
a. 已收集过表信息
b. 系统信息(虚拟机)
c. 部分系统参数
这是我的查询 SQL:
select a.tx_dt
,a.investor_id
,a.agmt_cd
,a.hedge_flg
,sum(a.count) bargain_count
from dc$investor_close_detail a
where a.openclose_flg <> '0'
group by a.tx_dt
,a.investor_id
,a.agmt_cd
,a.hedge_flg;
dc$investor_close_detail 该表是从 oracle 中迁移过来的,总量为192572697条,表结构如下:
同样的语句跟表结构,达梦 跟 Oracle 相差比较大
达梦约:3分钟不到
Oralce约: 37s
请问为何同样的表结构、数据,执行起来为何这么慢?有什么地方可以进行优化么?
把这四个字段创建一个索引试试
a.tx_dt
,a.investor_id
,a.agmt_cd
,a.hedge_flg
可以覆盖索引,执行计划做成SAGR试试
create index idx_test on dc$investor_close_detail (tx_dt,investor_id,agmt_cd,hedge_flg,count,openclose_flg);