性能优化日志【20090708】

查询语句:

 select level, t.*, t.pcontent_name || '【' || t.pact_code || '】' allName
    from v_list_pact_contents t
   where t.main_pact_code = 'JAQ/C3'
     AND T.base_pid is not null
   start with t.parent_id is null
  connect by t.parent_id = prior t.id
   order siblings by t.pcontent_code

 

执行时间:4.4s

优化过程:

分析当前查询的目标应用场景发现,仅有id,Item_type,pcontent_type,pcontent_code1,unit被使用,因此,修改结果列表为

select level,
       t.id,
       t.ITEM_TYPE,
       t.PCONTENT_TYPE,
       t.pcontent_code1,
       t.unit,    
       t.pcontent_name || '【' || t.pact_code || '】' allName

后执行时间0.2s

查询语句:

select level, t.*, t.pcontent_name || '【' || t.pact_code || '】' allName
  from (select distinct t.*
          from pact_contents t
         start with t.id in (select distinct t.id
                               from pact_below_viseinfo_base   b,
                                    pact_below_viseinfo_detail d,
                                    pact_contents              t
                              where b.cur_state >= 0
                                and b.vise_type = 0
                                and b.span_code <= '200905C'
                                and b.pact_code in
                                    (select P.pact_code
                                       from pact_base p, pact_base t
                                      where p.relation_id = t.id
                                        and t.pact_code = 'JAQ/C3')
                                and d.pcontent_id = t.id
                                and t.pact_code = b.pact_code
                                AND t.base_pcontent_id is null
)
        connect by t.id = prior t.parent_id
         order by t.parent_id, t.pact_code, t.pcontent_code) t
 start with t.parent_id is null
connect by t.parent_id = prior t.id


 


执行时间:2.7s

优化过程:

子查询(颜色标识)独立执行时间2.7s,分析该子查询发现

pact_contents.pact_code没有建立索引,创建索引(index_PACT_CONTENTS_090708)后,子查询执行时间2.0s,宿主查询执行时间2.0s

优化结论:

经上述处理之后,可节省查询时间大约4.9 s左右

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值