Skip to content

Instantly share code, notes, and snippets.

@RichVRed
Forked from ryanthames/costly_statements.sql
Created April 28, 2017 23:56
Show Gist options
  • Save RichVRed/fb49ede2f8339103e0c0cdd8cc3616a0 to your computer and use it in GitHub Desktop.
Save RichVRed/fb49ede2f8339103e0c0cdd8cc3616a0 to your computer and use it in GitHub Desktop.
select * from
(
select sql_id, sql_text, executions,
elapsed_time, cpu_time, buffer_gets, disk_reads,
elapsed_time / executions as avg_elapsed_time,
cpu_time / executions as avg_cpu_time,
buffer_gets / executions as avg_buffer_gets,
disk_reads / executions as avg_disk_reads
from v$sqlstats
where executions > 0
order by elapsed_time / executions desc
)
where rownum <= 25;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment