Last active
December 2, 2016 16:20
-
-
Save davidhooey/6235227 to your computer and use it in GitHub Desktop.
Oracle Elapsed Time Per Execution for SQL
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Shared Pool | |
select * | |
from | |
( | |
select | |
case when executions = 0 then 0 | |
else round(elapsed_time/executions, 3) | |
end "ElapsedPerExec(ms)", | |
elapsed_time "ElapsedTime (ms)", | |
executions "Executions", | |
sql_id "SQL_ID", | |
sql_fulltext "SQL_FULLTEXT" | |
from | |
v$sql | |
where | |
lower(sql_fulltext) like '%some sql search text%' | |
order by | |
1 desc | |
) | |
where | |
rownum <= 50 | |
-- AWR | |
select | |
sql_id "SQL_ID", | |
min(snap_id) "MIN_SNAP_ID", | |
max(snap_id) "MAX_SNAP_ID", | |
case when sum(executions_delta) = 0 then 0 | |
else round(sum(elapsed_time_delta)/sum(executions_delta), 3) | |
end "ElapsedPerExec(ms)", | |
sum(elapsed_time_delta) "ElapsedTime (ms)", | |
sum(executions_delta) "Executions" | |
from | |
dba_hist_sqlstat | |
where | |
sql_id = '3sgwcsv5qvfhf' | |
group by | |
sql_id |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment