SELECT *
FROM ( SELECT INST_ID,
SUBSTR (SQL_TEXT, 1, 500) SQL,
ELAPSED_TIME,
CPU_TIME,
DISK_READS,
EXECUTIONS,
DISK_READS / EXECUTIONS "Reads/Exec",
HASH_VALUE,
ADDRESS
FROM GV$SQLAREA
WHERE (INST_ID, HASH_VALUE, ADDRESS) IN
(SELECT DISTINCT INST_ID, HASH_VALUE, ADDRESS
FROM GV$SQL_PLAN
WHERE DISTRIBUTION IS NOT NULL)
AND DISK_READS > 100
AND EXECUTIONS > 0
ORDER BY ELAPSED_TIME DESC)
WHERE ROWNUM <= 30;
Showing posts with label Disk I/O. Show all posts
Showing posts with label Disk I/O. Show all posts
Wednesday, February 18, 2009
Which SQL are doing a lot of disk I/O
Which segments have top Logical I/O & Physical I/O
Summary
Do you know which segments in your database driven application have the largest amount of I/O, physical and logical?
This SQL helps to find out which segments are heavily accessed and helps to target tuning efforts on these segments:
Do you know which segments in your database driven application have the largest amount of I/O, physical and logical?
This SQL helps to find out which segments are heavily accessed and helps to target tuning efforts on these segments:
SELECT ROWNUM AS RANK, SEG_LIO.*
FROM ( SELECT ST.INST_ID,
ST.OWNER,
ST.OBJ#,
ST.OBJECT_TYPE,
ST.OBJECT_NAME,
ST.VALUE,
'LIO' AS UNIT
FROM GV$SEGMENT_STATISTICS ST
WHERE ST.STATISTIC_NAME = 'logical reads'
ORDER BY ST.VALUE DESC) SEG_LIO
WHERE ROWNUM <= 10
UNION ALL
SELECT ROWNUM AS RANK, SEQ_PIO_R.*
FROM ( SELECT ST.INST_ID,
ST.OWNER,
ST.OBJ#,
ST.OBJECT_TYPE,
ST.OBJECT_NAME,
ST.VALUE,
'PIO Reads' AS UNIT
FROM GV$SEGMENT_STATISTICS ST
WHERE ST.STATISTIC_NAME = 'physical reads'
ORDER BY ST.VALUE DESC) SEQ_PIO_R
WHERE ROWNUM <= 10
UNION ALL
SELECT ROWNUM AS RANK, SEQ_PIO_W.*
FROM ( SELECT ST.INST_ID,
ST.OWNER,
ST.OBJ#,
ST.OBJECT_TYPE,
ST.OBJECT_NAME,
ST.VALUE,
'PIO Writes' AS UNIT
FROM GV$SEGMENT_STATISTICS ST
WHERE ST.STATISTIC_NAME = 'physical writes'
ORDER BY ST.VALUE DESC) SEQ_PIO_W
WHERE ROWNUM <= 10;
Tablespace Disk I/O
Summary
The Physical design of the database reassures optimal performance for disk I/O.
Storing the datafiles in different filesystems (Disks) is a good technique to minimize disk contention for I/O.
How I/O is spread per tablespace
The Physical design of the database reassures optimal performance for disk I/O.
Storing the datafiles in different filesystems (Disks) is a good technique to minimize disk contention for I/O.
How I/O is spread per tablespace
SELECT T.NAME,
SUM (PHYSICAL_READS) PHYSICAL_READS,
ROUND ( (RATIO_TO_REPORT (SUM (PHYSICAL_READS)) OVER ()) * 100, 2)
|| '%'
PERC_READS,
SUM (PHYSICAL_WRITES) PHYSICAL_WRITES,
ROUND ( (RATIO_TO_REPORT (SUM (PHYSICAL_WRITES)) OVER ()) * 100, 2)
|| '%'
PERC_WRITES,
SUM (TOTAL) TOTAL,
ROUND ( (RATIO_TO_REPORT (SUM (TOTAL)) OVER ()) * 100, 2) || '%'
PERC_TOTAL
FROM ( SELECT TS#,
NAME,
PHYRDS PHYSICAL_READS,
PHYWRTS PHYSICAL_WRITES,
PHYRDS + PHYWRTS TOTAL
FROM V$DATAFILE DF, V$FILESTAT FS
WHERE DF.FILE# = FS.FILE#
ORDER BY PHYRDS DESC) A,
SYS.TS$ T
WHERE A.TS# = T.TS#
GROUP BY T.NAME
ORDER BY PHYSICAL_READS DESC;
Datafiles Disk I/O
Summary
The Physical design of the database reassures optimal performance for disk I/O.
Storing the datafiles in different filesystems (disks) is a good technique to minimize disk contention for I/O.
How I/O is spread per datafile
Tip: ORDER BY phyrds, order by physical reads descending. ORDER BY phywrts, order by physical writes descending.
How I/O is spread per filesystem
Tip: To see the filesystems correct experiment with the SUBSTR(NAME, 0, 9)
How I/O is spread for the datafiles of a specific tablespace
The Physical design of the database reassures optimal performance for disk I/O.
Storing the datafiles in different filesystems (disks) is a good technique to minimize disk contention for I/O.
How I/O is spread per datafile
SELECT NAME,
PHYRDS PHYSICAL_READS,
ROUND ( (RATIO_TO_REPORT (PHYRDS) OVER ()) * 100, 2) || '%' PERC_READS,
PHYWRTS PHYSICAL_WRITES,
ROUND ( (RATIO_TO_REPORT (PHYWRTS) OVER ()) * 100, 2) || '%'
PERC_WRITES,
PHYRDS + PHYWRTS TOTAL
FROM V$DATAFILE DF, V$FILESTAT FS
WHERE DF.FILE# = FS.FILE#
ORDER BY PHYRDS DESC;
Tip: ORDER BY phyrds, order by physical reads descending. ORDER BY phywrts, order by physical writes descending.
How I/O is spread per filesystem
SELECT FILESYSTEM,
ROUND ( (RATIO_TO_REPORT (READS) OVER ()) * 100, 2) || '%' PERC_READS,
ROUND ( (RATIO_TO_REPORT (WRITES) OVER ()) * 100, 2) || '%'
PERC_WRITES,
ROUND ( (RATIO_TO_REPORT (TOTAL) OVER ()) * 100, 2) || '%' PERC_TOTAL
FROM ( SELECT FILESYSTEM,
SUM (PHYSICAL_READS) READS,
SUM (PHYSICAL_WRITES) WRITES,
SUM (TOTAL) TOTAL
FROM ( SELECT SUBSTR (NAME, 0, 9) FILESYSTEM,
PHYRDS PHYSICAL_READS,
ROUND ( (RATIO_TO_REPORT (PHYRDS) OVER ()) * 100, 2)
|| '%'
PERC_READS,
PHYWRTS PHYSICAL_WRITES,
ROUND ( (RATIO_TO_REPORT (PHYWRTS) OVER ()) * 100, 2)
|| '%'
PERC_WRITES,
PHYRDS + PHYWRTS TOTAL
FROM V$DATAFILE DF, V$FILESTAT FS
WHERE DF.FILE# = FS.FILE#
ORDER BY TOTAL DESC) A
GROUP BY FILESYSTEM) B
ORDER BY PERC_TOTAL DESC;
Tip: To see the filesystems correct experiment with the SUBSTR(NAME, 0, 9)
How I/O is spread for the datafiles of a specific tablespace
SELECT DF.NAME,
PHYRDS PHYSICAL_READS,
ROUND ( (RATIO_TO_REPORT (PHYRDS) OVER ()) * 100, 2) || '%' PERC_READS,
PHYWRTS PHYSICAL_WRITES,
ROUND ( (RATIO_TO_REPORT (PHYWRTS) OVER ()) * 100, 2) || '%'
PERC_WRITES,
PHYRDS + PHYWRTS TOTAL
FROM V$DATAFILE DF, V$FILESTAT FS, TS$ T
WHERE DF.FILE# = FS.FILE# AND DF.TS# = T.TS# AND T.NAME = 'TABLESPACE_NAME'
ORDER BY PHYRDS DESC;
Subscribe to:
Posts (Atom)