Friday, May 27, 2011

Script to check top 128 sql.

select *
from
(
select
executions,
ROUND((cpu_time/1000000),2) total_cpu,
ROUND((elapsed_time/1000000),2) total_elapsed,
ROUND((cpu_time/1000000)/executions,2) cpu_per_e,
ROUND((elapsed_time/1000000)/executions,2) elapsed_per_e,
length(sql_fulltext),
sql_fulltext
from v$sql
where executions > 0
order by elapsed_per_e desc
)
where rownum <= 128;

No comments: