今天我们来看oracle top sql查询:
select round(100 * a.pct, 2) pct,
round(a.elapsed_time/1000000, 2) elapsed_time,
round(a.elapsed_time/a.executions/1000) ms_by_exec,
round(a.cpu_time/1000000, 2) cpu_time,
a.buffer_gets total_cost,
round(a.buffer_gets/a.executions) elem_cost,
a.executions exec,
a.rows_processed nb_rows,
s.sql_text
from (select *
from (select elapsed_time,
ratio_to_report(elapsed_time) over () pct,
cpu_time,
buffer_gets,
executions,
rows_processed,
address,
hash_value
from v$sql
order by elapsed_time desc)
where rownum < 26) a,
v$sqlarea s
where a.address = s.address
and a.hash_value = s.hash_value
and a.executions <> 0
order by pct desc, cpu_time desc;
我们可以重点看图上标注的值