ITPub博客

首页 > 数据库 > Oracle > 获取执行次数最多和单次执行时间最长的10个SQL

获取执行次数最多和单次执行时间最长的10个SQL

原创 Oracle 作者:super_sky 时间:2013-12-19 13:58:40 0 删除 编辑
获取执行次数最多的10个SQL
select sql_text,executions
from (
select sql_text,executions,rank() over(order by executions desc) exec_rank
from v$sql
)
where exec_rank <=10;

获取单次执行时间最长的10个SQL
select sql_id,sql_text,round(exec_time/1000000,0) exec_time
from(
select sql_id,sql_text,exec_time,rank() over (order by exec_time desc) exec_rank
from
(
select sql_id,sql_text,cpu_time,elapsed_time,executions,round(elapsed_time/executions,0) exec_time
from v$sql
where executions>1
)
)
where exec_rank <=10;

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/11590946/viewspace-1063766/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2011-01-11

  • 博文量
    77
  • 访问量
    807926