Skip to content

Instantly share code, notes, and snippets.

@glandaverde
Created November 10, 2015 17:36
Show Gist options
  • Save glandaverde/7a55057cfdfd932faae1 to your computer and use it in GitHub Desktop.
Save glandaverde/7a55057cfdfd932faae1 to your computer and use it in GitHub Desktop.
top sql in awr
select * from (
SELECT SQL_ID, MODULE, ACTION, RANK () OVER (ORDER BY avgt DESC) AS ELAPSED_RANK,avgt as "execution time(sec)" from
(
select SQL_ID, MODULE, ACTION,ROUND(SUM(ELAPSED_TIME_DELTA)/SUM(decode(executions_delta,0,1,executions_delta))/1000000,5) avgt
FROM DBA_HIST_SQLSTAT
where SNAP_ID between and
group by SQL_ID, MODULE, ACTION
))
WHERE ELAPSED_RANK <= 15;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment