Statspack Io operations and buffer hit rate

Source: Internet
Author: User

-- Physical zookeeper operation
Select distinct to_char (snap_time, 'yyyy-mm-dd hh24: MI: ss') datetime,
(Newreads. Value-oldreads. Value) reads,
(Newwrites. Value-oldwrites. Value) writes
From perfstat. Stats $ sysstat oldreads,
Perfstat. Stats $ sysstat newreads,
Perfstat. Stats $ sysstat oldwrites,
Perfstat. Stats $ sysstat newwrites,
Perfstat. Stats $ snapshot Sn
Where newreads. snap_id = Sn. snap_id
And newwrites. snap_id = Sn. snap_id
And oldreads. snap_id = Sn. snap_id-1
And oldwrites. snap_id = Sn. snap_id-1
And oldreads. Statistic # = 42 -- 42 physical reads
And newreads. Statistic # = 42
And oldwrites. Statistic # = 46 -- 46 physical writes
And newwrites. Statistic # = 46
And (newreads. Value-oldreads. Value)> 0
And (newwrites. Value-oldwrites. Value)> 0
And snap_time> to_date ('2017-07-08 18:00:00 ', 'yyyy-mm-dd hh24: MI: ss ')
;

-- Buffer hit rate
Select substr (to_char (snap_time, 'yyyy-mm-dd hh24: Mi'), 12 ),
Round (100 * (A. Value-E. Value) + (B. Value-F. Value ))-
(C. Value-G. Value ))/
(A. Value-E. Value) + (B. Value-F. Value) "buffer hit ratio"
From perfstat. Stats $ sysstat,
Perfstat. Stats $ sysstat B,
Perfstat. Stats $ sysstat C,
Perfstat. Stats $ sysstat D,
Perfstat. Stats $ sysstat e,
Perfstat. Stats $ sysstat F,
Perfstat. Stats $ sysstat G,
Perfstat. Stats $ snapshot Sn
Where a. snap_id = Sn. snap_id
And B. snap_id = Sn. snap_id
And C. snap_id = Sn. snap_id
And D. snap_id = Sn. snap_id
And E. snap_id = Sn. snap_id-1
And F. snap_id = Sn. snap_id-1
And G. snap_id = Sn. snap_id-1
And a. Statistic # = 40
And E. Statistic # = 40
And B. Statistic # = 41
And F. Statistic # = 41
And C. Statistic # = 42
And G. Statistic # = 42
And D. Statistic # = 46
And snap_time> to_date ('2017-07-08 18:00:00 ', 'yyyy-mm-dd hh24: MI: ss ')
;
/*
40 dB block gets
41 consistent gets
42 physical reads
46 physical writes
*/
-- Buffer hit rate calculation formula
Formula 1:
Select name,
(Consistent_gets + db_block_gets)-physical_reads )/
(Consistent_gets + db_block_gets) * 100 "hit ratio %"
From v $ buffer_pool_statistics
Where physical_reads> 0 ;?
Formula 2:
Hit ratio = 1-(physical reads-physical reads direct (LOB ))/
(Db block gets + consistent gets-physical reads direct (LOB ))
Formula 3:
Hit ratio = 1-[physical reads/(block gets + consistent gets)]

Select name,
Physical_reads,
Db_block_gets,
Consistent_gets,
1-(physical_reads/(db_block_gets + consistent_gets) "hit ratio"
From v $ buffer_pool_statistics
Where name = 'default ';

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.