查阅Oracle最耗时的SQL

select *
  from (select v.sql_id,
               v.child_number,
               v.sql_text,
               v.elapsed_time,
               v.cpu_time,
               v.disk_reads,
               rank() over(order by v.disk_reads desc) elapsed_rank
          from v$sql v) a
 where elapsed_rank <= 10;

 

select *
  from (select v.sql_id,
               v.child_number,
               v.sql_text,
               v.elapsed_time,
               v.cpu_time,
               v.disk_reads,
               rank() over(order by v.cpu_time desc) elapsed_rank
          from v$sql v) a
 where elapsed_rank <= 10;

Oracle, 

 

发出老多种情势可就此来寻觅有怎么着SQL语句需要优化,可是充裕漫长以来,最简便的办法如故分析保存于V$SQL视图被之缓存的SQL消息。通过V$SQL视图,可以规定有强消耗时间、CUP和IO读取的SQL语句。

2.查看CPU消耗时间最好多的前头10修SQL语句

3.翻消耗磁盘读取最多之眼前10久SQL语句

select *
  from (select v.sql_id,
               v.child_number,
               v.sql_text,
               v.elapsed_time,
               v.cpu_time,
               v.disk_reads,
               rank() over(order by v.elapsed_time desc) elapsed_rank
          from v$sql v) a
 where elapsed_rank <= 10;

1.查究竟吃时间最好多的前边10长条SQL语句

相关文章