如何识别 Oracle 中消耗更多资源的 SQL?
oraclesoftware & codingprogramming
问题:
您想要识别 Oracle 中消耗更多资源的 SQL 语句。
解决方案
"V$SQLSTATS"视图显示最近执行的 SQL 语句的性能统计信息。您还可以使用"V$SQL"和"V$SQLAREA"来报告 SQL 资源使用情况。
"V$SQLSTATS"速度更快,信息保留时间更长,但仅包含"V$SQL"和"V$SQLAREA"中列的子集。
示例
select * from( select sql_text ,buffer_gets ,disk_reads ,sorts ,cpu_time/1000000 cpu_sec ,executions ,rows_processed from v$sqlstats order by cpu_time DESC) where rownum < 20;