查詢oracle sql語句執行最慢和執行最多的語句!


1.查詢sql執行最慢的語句

 select * from (select a.sql_text,a.sql_fulltext,a.executions "執行次數",round(a.elapsed_time / 1000000,2) "總執行時間",
 round(a.elapsed_time / 1000000 / a.executions,2) "平均時間",a.command_type,a.parsing_user_id "用戶ID",b.username "用戶",a.hash_value from
 v$sqlarea a left join all_users b on a.parsing_user_id=b.user_id where a.executions>0 order by (a.ELAPSED_TIME / a.executions) desc) where
 rownum<=50;

2.執行次數最多的sql語句

 select * from (select a.sql_text,a.executions "執行次數",a.parsing_user_id "用戶",rank() over(order by a.executions desc) exec_rank
 from v$sql a left join all_users b on a.PARSING_USER_ID=b.user_id) c where exec_rank<=100; 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM