----当前最耗资源的10个cpu

select * from (select address,hash_value,
round(cpu_time/1000000) cpu_time_s,
round(cpu_time/decode(executions,0,1,executions)/1000000,2) cpu_time_per,
executions,
SQL_TEXT
from v$sqlarea
order by cpu_time_s desc)
where rownum <= 10;

----当前最耗资源的10个cpu

select * from (select A.ADDRESS,A.hash_value,B.sid,p.SPID,
round (A.CPU_TIME /1000000) cpu_time_s,
round(A.cpu_time/decode(executions,0,1,executions)/1000000,2) cpu_time_per,
A.executions,
A.SQL_TEXT
from V$SQLAREA A, V$SESSION B, V$PROCESS P
WHERE B.SQL_HASH_VALUE = A.HASH_VALUE
AND P.ADDR = B.PADDR
order by cpu_time_s desc)
where rownum <= 10;

---历史分析sql_id

set lines 155
col execs for 999,999,999
col avg_etime for 999,999.999
col avg_lio for 999,999,999.9
col begin_interval_time for a30
col node for 99999
break on plan_hash_value on startup_time skip 1
select ss.snap_id, ss.instance_number node, begin_interval_time, sql_id, plan_hash_value,
nvl(executions_delta,0) execs,
(elapsed_time_delta/decode(nvl(executions_delta,0),0,1,executions_delta))/1000000 avg_etime,
(buffer_gets_delta/decode(nvl(buffer_gets_delta,0),0,1,executions_delta)) avg_lio
from DBA_HIST_SQLSTAT S, DBA_HIST_SNAPSHOT SS
where sql_id = nvl('&sql_id','4dqs2k5tynk61')
and ss.snap_id = S.snap_id
and ss.instance_number = S.instance_number
and executions_delta > 0
order by 1, 2, 3
/

最耗资源的10条sql的更多相关文章

  1. 【MySQL】10条SQL优化语句,让你的MySQL数据库跑得更快!

    慢SQL消耗了70%~90%的数据库CPU资源: SQL语句独立于程序设计逻辑,相对于对程序源代码的优化,对SQL语句的优化在时间成本和风险上的代价都很低: SQL语句可以有不同的写法: 1 不使用子 ...

  2. 10条SQL优化语句,让你的MySQL数据库跑得更快!

    慢SQL消耗了70%~90%的数据库CPU资源: SQL语句独立于程序设计逻辑,相对于对程序源代码的优化,对SQL语句的优化在时间成本和风险上的代价都很低: SQL语句可以有不同的写法: 1 不使用子 ...

  3. 或许你不知道的10条SQL技巧(转自58沈剑原创)

    这几天在写索引,想到一些有意思的TIPS,希望大家有收获. 一.一些常见的SQL实践 (1)负向条件查询不能使用索引 select * from order where status!=0 and s ...

  4. 或许你不知道的10条SQL技巧

    一.一些常见的SQL实践 (1)负向条件查询不能使用索引 select * from order where status!=0 and stauts!=1 not in/not exists都不是好 ...

  5. 你可能不知道的 10 条 SQL 技巧,涨知识了!

    转自:http://mp.weixin.qq.com/s?__biz=MjM5NzM0MjcyMQ==&mid=2650076293&idx=1&sn=38f6acc759df ...

  6. 或许你不知道的10条SQL

    一.一些常见的SQL实践 (1)负向条件查询不能使用索引 select * from order where status!=0 and stauts!=1 not in/not exists都不是好 ...

  7. SQL Server 常用近百条SQL语句(收藏版)

    1. sqlserver查看实例级别的信息,使用SERVERPROPERTY函数 select SERVERPROPERTY ('propertyname') 2. 查看实例级别的某个参数XX的配置 ...

  8. DRF cbv源码分析 restful规范10条 drf:APIView的源码 Request的源码 postman的安装和使用

    CBV 执行流程 路由配置:url(r'^test/',views.Test.as_view()),  --> 根据路由匹配,一旦成功,会执行后面函数(request) --> 本质就是执 ...

  9. 一条SQL在内存结构与后台进程工作机制

    oracle服务器由数据库以及实例组成,数据库由数据文件,控制文件等物理文件组成,实例是由内存结构+后台进程组成,实例又可以看做连接数据库的方式,在我看来就好比一家公司,实例就是一个决策的办公室,大大 ...

随机推荐

  1. Web app root system property already set to different value: 'webapp.root'

    java.lang.IllegalStateException: Web app root system property already set to different value: 'webap ...

  2. python cassandra 创建space table并写入和查询数据

    from cassandra.cluster import Cluster cluster = Cluster(["10.178.209.161"]) session = clus ...

  3. Hihocder 1639 : 图书馆 (组合数+唯一分解 求最后一位)(妙)

    给定n,(n<=10^3),然后输入n的数a[i],(a[i]<=1e10),求ans=(a1+a2+a3...an)! / (a1!*a2!*a3!...an!) 的结果的最一位数. 适 ...

  4. caffe参数详解

     转载自:https://blog.csdn.net/qq_14845119/article/details/54929389 solver.prototxt net:训练预测的网络描述文件,trai ...

  5. bzoj 5072 [Lydsy1710月赛]小A的树——树形dp

    题目:https://www.lydsy.com/JudgeOnline/problem.php?id=5072 发现对于每个子树,黑点个数确定时,连通块的大小取值范围一定是一段区间:所以考虑只最小化 ...

  6. GC及其作用

    Java GC 是垃圾回收机制,自动内存管理和垃圾清扫机制,释放内存中的资源和垃圾

  7. Visual Studio Ultimate 2013 下载地址

    VS2013_RTM_ULT_CHS.iso 文件大小:2.87G 百度网盘下载地址: http://pan.baidu.com/s/1bn4gavX 微软官网下载地址: http://downloa ...

  8. Asset Catalog Help (十)---Specifying a Resizable Area of an Image

    Specifying a Resizable Area of an Image Use the Xcode Slicing feature to specify the dimensions of a ...

  9. Httpclient入门代码

    /** * Project Name:httpClient * File Name:Test.java * Package Name:httpClient * Date:2017年11月9日上午8:3 ...

  10. struts2注解的作用

    Struts2注解 1 Struts2注解的作用 使用注解可以用来替换struts.xml配置文件!!! 2 导包 必须导入struts2-convention-plugin-2.3.15.jar包, ...