oracle查看物理IO前十的表 值得收藏!

在对oracle做性能调优的时候,很多时候我们需要通过sql去知道哪些表IO消耗比较高,从而去优化。下面分享下一条很实用的sql,可以让你查看物理IO前十的表:

The next example demonstrates how to use V$SEGMENT_STATISTICS to determine the top 10 tables that have incurred the most physical I/O operations.

oracle查看物理IO前十的表 值得收藏!


SELECT TABLE_NAME,TOTAL_PHYS_IO

FROM ( SELECT OWNER||'.'||OBJECT_NAME AS TABLE_NAME,

SUM(VALUE) AS TOTAL_PHYS_IO

FROM V$SEGMENT_STATISTICS

WHERE OWNER!='SYS' AND OBJECT_TYPE='TABLE'

AND STATISTIC_NAME IN ('physical reads','physical reads direct',

'physical writes','physical writes direct')

GROUP BY OWNER||'.'||OBJECT_NAME

ORDER BY TOTAL_PHYS_IO DESC)

WHERE ROWNUM <=10;

oracle查看物理IO前十的表 值得收藏!

示例数据库

PS:大家也可以把rownum<=10改成20,30...

sql是死的,人是活的


后面会分享下怎么去看低效的sql、检查表空间之类的sql(都是平时工作会用到的),如果觉得有用的话关注下哦~

oracle查看物理IO前十的表 值得收藏!

相关推荐