-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathesfc_hit_ratio.sql
64 lines (61 loc) · 2.29 KB
/
esfc_hit_ratio.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
----------------------------------------------------------------------------------------
--
-- File name: esfc_hit_ratio.sql
--
-- Purpose: Calculates a psuedo hit ratio for cell flash cache on Exadata storage.
--
-- Author: Kerry Osborne
--
-- Description:
--
-- The script uses the total number of cell single block physical read" events
-- plus the total number of "cell multiblock physical read" events as an
-- approximation of the total number of reads and compares that to total number
-- of cell flash cache hits.
--
--
-- Note: This script does not produce accurate results. The calculated
-- hit ratio will be overstated. A better approach is to evaluate
-- average access times for read operations such as the
-- "cell single block physical read" event. Cache hits should be
-- under 1ms while missed will be on the order of a few ms.
--
-- In fact, the results may be wildy overstated in cases where
-- objects are aggressively cached in ESFC due to the storage
-- parameter CELL_FLASH_CACHE being set to KEEP, as this causes
-- Smart Scans to use the flash cache as well.
--
-- See kerryosborne.oracle-guy.com for additional information.
---------------------------------------------------------------------------------------
set pages 999
set lines 140
column c1 heading 'Event|Name' format a30 trunc
column c2 heading 'Total|Waits' format 99,999,999
column c3 heading 'Seconds|Waiting' format 9,999,999
column c5 heading 'Average|Wait|(ms)' format 9999.9
column c6 heading 'Flash Cache Hits' for 999,999,999,999
col hit_ratio heading 'Hit Ratio' for 999.999
select
'cell single + multiblock reads' c1,
c2, c3, c5, c6,
c6/decode(nvl(c2,0),0,1,c2) hit_ratio
from (
select
sum(total_waits) c2,
avg(value) c6,
sum(time_waited / 100) c3,
avg((average_wait /100)*1000) c5
from
sys.v_$system_event, v$sysstat ss
where
event in (
'cell single block physical read',
'cell multiblock physical read')
and
name like 'cell flash cache read hits'
and
event not like '%Idle%')
order by
c3
;
ttitle off