plsql中语句性能如何查看
2个回答
展开全部
V_$SQLAREA视图提供了执行的细节。(执行、读取磁盘和读取缓冲区的次数)
--性能最差的SQL
SELECT * FROM ( SELECT PARSING_USER_ID EXECUTIONS,SORTS,COMMAND_TYPE,DISK_READS,sql_text
FROM v$sqlarea
ORDER BY disk_reads DESC)
WHERE ROWNUM<200
--效率最低的语句
Select EXECUTIONS,DISK_READS,BUFFER_GETS,
ROUND((BUFFER_GETS-DISK_READS)/BUFFER_GETS,2) Hit_radio,
ROUND(DISK_READS/EXECUTIONS,2) Reads_per_run,
SQL_TEXT
From V$SQLAREA
WHERE EXECUTIONS>0 And BUFFER_GETS>0 And (BUFFER_GETS-DISK_READS)/BUFFER_GETS<0.8
ORDER By 4 DESC;
--性能最差的SQL
SELECT * FROM ( SELECT PARSING_USER_ID EXECUTIONS,SORTS,COMMAND_TYPE,DISK_READS,sql_text
FROM v$sqlarea
ORDER BY disk_reads DESC)
WHERE ROWNUM<200
--效率最低的语句
Select EXECUTIONS,DISK_READS,BUFFER_GETS,
ROUND((BUFFER_GETS-DISK_READS)/BUFFER_GETS,2) Hit_radio,
ROUND(DISK_READS/EXECUTIONS,2) Reads_per_run,
SQL_TEXT
From V$SQLAREA
WHERE EXECUTIONS>0 And BUFFER_GETS>0 And (BUFFER_GETS-DISK_READS)/BUFFER_GETS<0.8
ORDER By 4 DESC;
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询