处理因执行计划变更导致的性能问题(SQL执行次数、执行计划变化)

一、
select sum(executions_DELTA) from dba_hist_sqlstat  where SQL_ID='3m7n4vk1f8c43' and snap_id between 54601 and 54625 

查询某一时间段的SQL执行次数信息。AWR取值也来自于此。可以进行比较


二、查询SQL执行计划的改变,有几次变化。具体改变的时间。提取plan_hash_value
select distinct SQL_ID,PLAN_HASH_VALUE,to_char(TIMESTAMP,'yyyymmdd hh24:mi:ss')  TIMESTAMP
from dba_hist_sql_plan 
where SQL_ID='3m7n4vk1f8c43' order by TIMESTAMP;


另外:

还可以这样:(和上面感觉没什么区别,仅作记录)
    select a.INSTANCE_NUMBER,
          a.snap_id,
          a.sql_id,
      a.plan_hash_value,          b.begin_interval_time
    from dba_hist_sqlstat a, dba_hist_snapshot b
    where sql_id = '3m7n4vk1f8c43'
      and a.snap_id = b.snap_id
    order by instance_number, snap_id;
    



三、
通过代入plan_hash_value查出具体的执行计划情况
select plan_hash_value,id,operation,options,object_name,depth,cost,to_char(TIMESTAMP,'yyyymmdd hh24:mi:ss') xx
    from DBA_HIST_SQL_PLAN  
    where sql_id ='3m7n4vk1f8c43' 
    and plan_hash_value in (2702355013,1401032440,2282877665)
    order by xx,id
      

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值