The latch statistics in the V$LATCH family of views record a get whenever a
process acquires a latch in willing-to-wait mode. If the process fails to get the
latch without spinning, a miss is recorded. If the latch is obtained after one or
more spin iterations, a spin get is recorded. If the latch cannot be obtained while
spinning, the process relinquishes the CPU and enters a sleep. No matter how
many times the process subsequently wakes up, spins, and sleeps again, no
further gets or misses will be recorded, and neither will a spin get be recorded if
the latch is finally obtained while spinning. So, the number of times that a latch
was obtained without spinning at all is gets - misses. I call these simple gets. The
APT script. latch_gets.sql shows the breakdown of gets into simple gets, spin
gets, and gets that slept, called sleep gets.
column name format a30 heading "LATCH TYPE" trunc
column simple_gets format a18 heading "SIMPLE GETS" justify right
column spin_gets format a14 heading "SPIN GETS" justify right
column sleep_gets format a14 heading "SLEEP GETS" justify right
select
l.name,
substr(
to_char(
l.gets - l.misses,
'9999999990'
),
2
) ||
' ' ||
substr(
to_char(
100 * (l.gets - l.misses) / l.gets,
'999.00'
),
2
) ||
'%' simple_gets,
substr(
to_char(
l.spin_gets,
'9999990'
),
2
) ||
' ' ||
substr(
to_char(
100 * l.spin_gets / l.gets,
'90.00'
),
2
) ||
'%' spin_gets,
substr(
to_char(
l.misses - l.spin_gets,
'9999990'
),
2
) ||
' ' ||
substr(
to_char(
100 * (l.misses - l.spin_gets) / l.gets,
'90.00'
),
2
) ||
'%' sleep_gets
from
sys.v_$latch l
where
l.gets > 0
order by
l.name
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/16158219/viewspace-557742/ ,如需转载,请注明出处,否则将追究法律责任。