关于一致性读(consistent gets)的理解

[复制链接]
查看11 | 回复9 | 2010-8-24 01:01:01 | 显示全部楼层 |阅读模式
整理一下本人关于一致性读(consistent gets)的理解,欢迎大家拍砖!
介于前些天对 consistent gets 的意义不是很明白,于是上网看了,整理如下:
consistent gets:一致性读,为了保持读一致性而获取的块,
其中可能包括undo block,也有包括非undo block,而非undo block有有可能包括 buffer cache block ,也有可能包括 disk block。
consistent gets可以简单的理解为,最终的结果集所获取的块数。
db block gets:其实这个名字可能有点歧义,这个表示 no consistent gets,即非一致性读,
也就是说,一条查询语句发出后,所读的块中,除了consistent gets,就是db block gets,
所以才会有:consistent gets + db block gets = Logical IO 的说法。
physical reads:这个就更好理解了,物理读,就是从磁盘中读取出的 block 数目,这个参数大家的理解都没什么问题。
所以: physical reads =physical IO。
以上就是本人的理解,欢迎大家踊跃拍砖啊!


回复

使用道具 举报

千问 | 2010-8-24 01:01:01 | 显示全部楼层
logical IO internal可以看看这个ppt。
回复

使用道具 举报

千问 | 2010-8-24 01:01:01 | 显示全部楼层
原帖由 viadeazhu 于 2010-8-26 21:58 发表
logical IO internal可以看看这个ppt。

这 PPT 哪里有?


回复

使用道具 举报

千问 | 2010-8-24 01:01:01 | 显示全部楼层
truth be told , consistent is very easy to understand. it means oracle should protect data is consistent.
so how to do so ? SCN is the best way to protect when oracle fetch data ,but you know, when you fetch data,there are a lot of user is changing data. so when transcation is start. then record the scn.
if block scn> recored scn, than means this data can't use. because it's changed.
回复

使用道具 举报

千问 | 2010-8-24 01:01:01 | 显示全部楼层
原帖由 tom_fans 于 2010-8-27 15:01 发表
truth be told , consistent is very easy to understand. it means oracle should protect data is consistent.
so how to do so ? SCN is the best way to protect when oracle fetch data ,but you know, when you fetch data,there are a lot of user is changing data. so when transcation is start. then record the scn.
if block scn> recored scn, than means this data can't use. because it's changed.


回复

使用道具 举报

千问 | 2010-8-24 01:01:01 | 显示全部楼层
楼主理解大致正确, 其实也没必要深究
回复

使用道具 举报

千问 | 2010-8-24 01:01:01 | 显示全部楼层
原帖由 tom_fans 于 2010-8-27 15:01 发表
truth be told , consistent is very easy to understand. it means oracle should protect data is consistent.
so how to do so ? SCN is the best way to protect when oracle fetch data ,but you know, when you fetch data,there are a lot of user is changing data. so when transcation is start. then record the scn.
if block scn> recored scn, than means this data can't use. because it's changed.

恩,我也是这么理解的!


回复

使用道具 举报

千问 | 2010-8-24 01:01:01 | 显示全部楼层
理解是这样的,但怎样去判断问题呢?比如 consistentgets很大,db block gets很大,怎样从这2个值中看出性能瓶颈?
回复

使用道具 举报

千问 | 2010-8-24 01:01:01 | 显示全部楼层
终于明白了,consistent gets 与db block gets,physical reads 在性能统计方面作用主要是用来计算命中率的
db block gets与consistent gets构成一次数据库操作中读取的所有block的总次数。logical reads = (db block gets + consistent gets) - physical reads。
cache命中率计算:
Hit Ratio = 1 – (physical reads/(db block gets + consistent gets))
回复

使用道具 举报

千问 | 2010-8-24 01:01:01 | 显示全部楼层
原帖由 yanxiaojun_007 于 2010-8-30 14:54 发表
终于明白了,consistent gets 与db block gets,physical reads 在性能统计方面作用主要是用来计算命中率的
db block gets与consistent gets构成一次数据库操作中读取的所有block的总次数。logical reads = (db block gets + consistent gets) - physical reads。
cache命中率计算:
Hit Ratio = 1 – (physical reads/(db block gets + consistent gets))

” logical reads = (db block gets + consistent gets) - physical reads “
这个你理解的有点偏差,通常认为 logical reads = db block gets + consistent gets ,
从buffer中获得的块就是逻辑IO,物理块也是要读到buffer中,然后才能buffer中读这个块,就是逻辑IO了。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行