加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

oracle 耗资源比较大的SQL

发布时间:2020-12-12 13:36:48 所属栏目:百科 来源:网络整理
导读:时间: select sql_id,sid,serial#,username,target,sql_plan_operation,sofar blocks_read,totalwork total_blocks,round(time_remaining/60) minutes from v$session_longops where sofartotalwork and username=‘XXX‘ sofar : Units of work done so fa
时间:

select sql_id,sid,serial#,username,target,sql_plan_operation,sofar blocks_read,totalwork total_blocks,round(time_remaining/60) minutes from v$session_longops
where sofar<>totalwork
and username=‘XXX‘

sofar : Units of work done so far for the operation specified in the OPNAME column
这个值会一直增加

Totalwork:Total units of work for the operation specified in the OPNAME column
预估出的总数据块读取量,不会改变

Time_remaining:Estimate (in seconds) of time remaining for the operation to complete

V$SESSION_LONGOPS displays the status of various operations that run for longer than 6 seconds (in absolute time). These operations currently include many backup and recovery functions,statistics gathering,and query execution,and more operations are added for every Oracle release.

官方文档并未对v$session_longops原理做详细的介绍,想要通过v$session_longops监控一个操作,需要满足以下条件:

1 执行操作超过6秒
2 执行操作访问数据块必须大于10000
3 必须设置了TIMED_STATISTICS或者打开了SQL_TRACE
4 执行操作中的对应必须通过DBMS_STATS或ANALYZE进行了分析

IO

select sql_id,disk_reads from
(select sql_id,buffer_gets,disk_reads,sorts,cpu_time/1000000 cpu,rows_processed,elapsed_time from v$sqlstats
order by disk_reads desc

--- 具体要依据什么信息排序可适当选择,而此视图里的多项值是累积的

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读