Table Access Ratios

Submitted by UMBRO
on August 13, 2007 - 8:43pm


SELECT 'Short to Long Full Table Scans' "Ratio",
ROUND
( (SELECT SUM (VALUE)
FROM v$sysstat
WHERE NAME = 'table scans (short tables)')
/ (SELECT SUM (VALUE)
FROM v$sysstat
WHERE NAME IN
('table scans (short tables)',
'table scans (long tables)'
))
* 100,
2
)
|| '%' "Percentage"
FROM DUAL
UNION
SELECT 'Short Table Scans ' "Ratio",
ROUND
( (SELECT SUM (VALUE)
FROM v$sysstat
WHERE NAME = 'table scans (short tables)')
/ (SELECT SUM (VALUE)
FROM v$sysstat
WHERE NAME IN
('table scans (short tables)',
'table scans (long tables)',
'table fetch by rowid'
))
* 100,
2
)
|| '%' "Percentage"
FROM DUAL
UNION
SELECT 'Long Table Scans ' "Ratio",
ROUND
( (SELECT SUM (VALUE)
FROM v$sysstat
WHERE NAME = 'table scans (long tables)')
/ (SELECT SUM (VALUE)
FROM v$sysstat
WHERE NAME IN
('table scans (short tables)',
'table scans (long tables)',
'table fetch by rowid'
))
* 100,
2
)
|| '%' "Percentage"
FROM DUAL
UNION
SELECT 'Table by Index ' "Ratio",
ROUND
( (SELECT SUM (VALUE)
FROM v$sysstat
WHERE NAME = 'table fetch by rowid')
/ (SELECT SUM (VALUE)
FROM v$sysstat
WHERE NAME IN
('table scans (short tables)',
'table scans (long tables)',
'table fetch by rowid'
))
* 100,
2
)
|| '%' "Percentage"
FROM DUAL
UNION
SELECT 'Efficient Table Access ' "Ratio",
ROUND
( (SELECT SUM (VALUE)
FROM v$sysstat
WHERE NAME IN
('table scans (short tables)',
'table fetch by rowid'
))
/ (SELECT SUM (VALUE)
FROM v$sysstat
WHERE NAME IN
('table scans (short tables)',
'table scans (long tables)',
'table fetch by rowid'
))
* 100,
2
)
|| '%' "Percentage"
FROM DUAL;

Excerpted from

on
August 13, 2007 - 8:53pm

Excerpted from Digital.Press.Oracle.Performance.Tuning.for.10gR2.2nd.Edition.Sep.2006

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.