ORACLE跟新数据的性能提升(通过中间表)

--更新历程权力值
--1.查询效率慢的
update FW_WF_COURSE c set c.power =
(select distinct from jbpm_taskinstance t1 where t1.id_ = c.task_id)
where c.power is null;

 

--查询效率快
create table FW_WF_COU_BP as
select * from (select distinct c.course_id ,t1.power_ from FW_WF_COURSE c ,jbpm_taskinstance t1
where t1.id_ = c.task_id and c.power is null and nvl(t1.power_ ,0) > 0  );

alter table FW_WF_COU_BP modify course_id unique;

 

update (select c.power cp ,cb.power tp from FW_WF_COURSE c ,FW_WF_COU_BP cb where c.course_id = cb.course_id)
set cp = tp;
commit;

 

--跟新历程节点编码
--1.查询效率慢的
update FW_WF_COURSE c set c.node_code =
(select n.code_ from jbpm_node n where n.id = (select nvl(k.tasknode_ ,k.startstate_) from jbpm_task k
where k.id = (select distinct t1.task_ from jbpm_taskinstance t1 where t1.id_ = c.task_id)));
where c.power is null;

 

--查询效率快
create table FW_WF_COU_BP as
select * from (
       select distinct c.course_id ,n.code_ from FW_WF_COURSE c ,jbpm_node n ,jbpm_taskinstance t1 ,jbpm_task tk
       where c.task_id = t1.id_ and t1.task_ = tk.id_ and nvl(k.tasknode_ ,k.startstate_) = n.id_
       and c.node_code is null and n.code_ is not null

);

 

alter table FW_WF_COU_BP modify course_id unique;

 

update (select c.node_code cn ,cb.code cc from FW_WF_COURSE c ,FW_WF_COU_BP cb where c.course_id = cb.course_id)
set cn = cc;
commit;

 

truncate table FW_WF_COU_BP;

 

zoujianhua@huawei.com

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值