Oracle collects statistics on data access and stores them in the dynamic performance
table V$SYSSTAT. You measure the cache hit ratio using three system statistics:
? db block gets: Accesses to the current image of a block
? consistent gets: Accesses to a read-consistent image of a block
? physical reads: Number of blocks read from disk
Calculate the hit ratio for the buffer cache with this formula:
Hit Ratio = 1 – (physical reads/(db block gets + consistent gets))
Adding db_blocks_gets and consistent_gets gives the total number of requests
for data. This value includes requests satisfied by access to buffers in memory and
requests that cause a physical I/O. You can multiply the ratio by 100 to convert to a
percentage.
我的理解是:
db_blocks_gets是 query 得到的所有data blocks的数目
consistent_gets是 除了 query 之外的其他操作而得到 data blocks的数目,比如insert,update
physical reads是 从磁盘 读到的 data blocks 数量,而且只算 Input,不算Output
可我总觉得不太对劲,希望各位能释疑,谢谢
另外,比如我要insert 一条纪录的时候,这个 oracle的工作过程是怎样的?
Oracle文档:
db block gets: Accesses to the current image of a block
consistent gets: Accesses to a read-consistent image of a block
physical reads: Number of blocks read from disk
Hit Ratio = 1 – (physical reads/(db block gets + consistent gets))
我的理解:
db block gets: 获取数据的当前映像所读取的数据块。
Oracle为了获取数据的当前映像,会先去数据缓存(Data cache)中找,如果有就直接读取(逻辑读),如果没有再去数据文件中读取(物理读)。
consistent gets: 获取数据的读一致性映像所读取的数据块。
应该仅发生在用户查询时该数据块正在被修改的情况下,则数据的前映像在回滚段中,Oracle为了获取一致性映像,必须从回滚段中读取(物理读)。
physical reads: 所有物理读的总数。
从而: db block gets + consistent gets 就是所有读取操作涉及的数据块
则物理读在所有读操作中所占的比例就是:
physical reads/(db block gets + consistent gets)
数据高速缓存的命中率就应该是:
Hit Ratio = 1 – (physical reads/(db block gets + consistent gets))
请高人斧正!谢谢