前端之家收集整理的这篇文章主要介绍了
Oracle慢SQL,
前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
select *
from (
select
rank() over(order by v.cpu_time desc) "rank",v.sql_id,sa.sql_fulltext as sql_FULLTEXT,--case WHEN "LENGTH"(v.sql_text)=1000 then 1 else 0 end as "len_gt_1000",v.EXECUTIONS AS "执行次数",v.FIRST_LOAD_TIME AS 初次载入时间,cast(v.elapsed_time/1000/v.EXECUTIONS as INTEGER) AS "AVG_消耗时间s",cast(v.cpu_time/1000/v.EXECUTIONS as INTEGER) AS "AVG_cpu时间s",--cast(v.elapsed_time/1000 as INTEGER) AS "消耗时间s",--cast(v.cpu_time/1000 as INTEGER) AS "cpu时间s",CAST(v.disk_reads/v.executions as integer) as "AVG_DISKREADS"
from v$sql v INNER JOIN v$sqlarea sa on v.sql_id=sa.sql_id
) a
where "rank" <= 20;