查看: 12968|回复: 26

这两个术语困惑了我几天了;db block gets & consistent gets

[复制链接]
论坛徽章:
2
授权会员
日期:2005-10-30 17:05:33会员2006贡献徽章
日期:2006-04-17 13:46:34
跳转到指定楼层
1#
发表于 2004-5-25 17:23 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
SQL> select count(*) from users;


Statistics
-----------------------------------------------------
          0  recursive calls
          2  db block gets
         10  consistent gets
          0  physical reads

db block gets 和consistent gets 两者有什么区别。
各位辛苦点给我简单介绍一下。我自己找了些英文资料。看了tom的回答,还是有点犯糊涂;
db block gets :
当前模式下,只读取现在存在的数据块。这种方式并不象在“读一致性样式”那样。正常情况下,当一个查询开始时候,符合该查询条件的块如果存在,就被获得,读取。Current Mode只要那些块现在(不是从在此之前的某个时间点算起)就存在那儿,就读取
(Current mode blocks are retrieved as they exist right now, not in a consistent read fashion.Normally, blocks retrieved for a query are retrieved as they existed when the query began. Current mode blocks are retrieved as they exist right now, not from a previous point in time.During a SELECT, you might see current mode retrievals due to reading the data dictionary to find the extent information for a table to do a full scan (because you need the "right now" information, not the consistent read). During a modification, you will access the blocks in current mode in order to write to them. )

consistent gets: 这是指在“读一致性样式”下,你总共处理的数据块数目.包括为了回滚而被读入回滚段的数据块,当你做一些编辑、删除操作时,首先在“读一致性样式”你会读取数据块,然后在”当前模式“下进行真正的编辑工作

偶英文差了点,翻译的很费劲,很难理解。
还请高手名师,指点。
论坛徽章:
1
授权会员
日期:2005-10-30 17:05:33
2#
发表于 2004-5-25 17:44 | 只看该作者
简而言之
select * from ...........where .......               consistent gets
update * from ..........where........               db block gets

使用道具 举报

回复
论坛徽章:
116
ITPUB北京九华山庄2008年会纪念徽章
日期:2008-01-21 16:50:24马上有对象
日期:2014-02-19 11:55:14马上加薪
日期:2014-02-19 11:55:14沸羊羊
日期:2015-03-04 14:43:432015年新春福章
日期:2015-03-06 11:57:31喜羊羊
日期:2015-03-25 15:04:022010数据库技术大会纪念徽章
日期:2015-04-23 10:33:192011数据库大会纪念章
日期:2015-04-23 10:33:192012数据库大会纪念章
日期:2015-04-23 10:33:192013数据库大会纪念章
日期:2015-04-23 10:33:19
3#
发表于 2004-5-25 18:04 | 只看该作者
我也非常的不懂,仅仅死记了两者和为逻辑读次数

-----------------------------------------
DB Block Gets. Number of times a CURRENT block was requested.

Current mode blocks are retrieved as they exist right now, not in a consistent read fashion. Normally, blocks retrieved for a query are retrieved as they existed when the query began. Current mode blocks are retrieved as they exist right now, not from a previous point in time. During a SELECT, you might see current mode retrievals due to reading the data dictionary to find the extent information for a table to do a full scan (because you need the "right now" information, not the consistent read). During a modification, you will access the blocks in current mode in order to write to them.

·         Consistent Gets. Number of times a consistent read was requested for a block.

This is how many blocks you processed in "consistent read" mode. This will include counts of blocks read from the rollback segment in order to roll back a block. This is the mode you read blocks in with a SELECT, for example. Also, when you do a searched UPDATE/DELETE, you read the blocks in consistent read mode and then get the block in current mode to actually do the modification.


-----------------------------------------------
    DB Block Gets. 当前块被请求的次数。

当存在时,当前模式块将被立即检索,而不会以一致读的方式检索。通常,查询检索的块如果在查询开始时存在,它们就被检索。当前模式块如果存在就立即被检索,而不是从一个以前的时间点检索。在一个SELECT期间,你可以看到当前模式检索,因为对于需要进行全面扫描的表来说,需要读数据字典来找到范围信息(因为你需要"立即"信息,而不是一致读)。在修改期间,为了向块中写入内容,你要以当前模式访问块。

·         Consistent Gets. 对于一个块一致读被请求的次数。

这是你以"一致读"模式处理的块数。为了回滚一个块,这将包括从回滚段读取的块的数目。例如,这是你在SELECT语句中读取块的模式。当你进行一个指定的UPDATE/DELETE操作时,你也以一致读模式读取块,然后以当前模式获得块以便实际进行修改。

使用道具 举报

回复
论坛徽章:
116
ITPUB北京九华山庄2008年会纪念徽章
日期:2008-01-21 16:50:24马上有对象
日期:2014-02-19 11:55:14马上加薪
日期:2014-02-19 11:55:14沸羊羊
日期:2015-03-04 14:43:432015年新春福章
日期:2015-03-06 11:57:31喜羊羊
日期:2015-03-25 15:04:022010数据库技术大会纪念徽章
日期:2015-04-23 10:33:192011数据库大会纪念章
日期:2015-04-23 10:33:192012数据库大会纪念章
日期:2015-04-23 10:33:192013数据库大会纪念章
日期:2015-04-23 10:33:19
4#
发表于 2004-5-25 18:06 | 只看该作者
引用的出处和楼主一样,下面的中文是oramag翻译的

使用道具 举报

回复
论坛徽章:
86
ITPUB元老
日期:2005-02-28 12:57:002012新春纪念徽章
日期:2012-01-04 11:49:542012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:20咸鸭蛋
日期:2012-05-08 10:27:19版主8段
日期:2012-05-15 15:24:112013年新春福章
日期:2013-02-25 14:51:24
5#
发表于 2004-5-25 18:27 | 只看该作者
db  block gets :  current  mode  , 不管这个块上的数据是否可能存在 before  image ,也就是说不管是否存在回滚中数据可以 回滚,只看见当前最新块的数据,即使别人正在更新,也看见别人更新状态的数据,比如dml的时候就不需要看见别人更改前的数据,而是看见正在更改的,当然同时,若操作相同数据则被lock住
。也就是说一次查询中看见的数据可能不在同一个时间点上
consistent gets : 看见的数据是查询开始的时间点的,所以若存在block在查询开始后发生了变化的情况,则必须产生 before  image 然后读数据,这就是一致读的含义

使用道具 举报

回复
论坛徽章:
42
ITPUB北京香山2007年会纪念徽章
日期:2007-01-24 14:35:022011新春纪念徽章
日期:2011-01-25 15:42:332011新春纪念徽章
日期:2011-01-25 15:42:56管理团队成员
日期:2011-05-07 01:45:08ITPUB十周年纪念徽章
日期:2011-11-01 16:20:282012新春纪念徽章
日期:2012-02-13 15:09:232012新春纪念徽章
日期:2012-02-13 15:09:232012新春纪念徽章
日期:2012-02-13 15:09:232012新春纪念徽章
日期:2012-02-13 15:09:232012新春纪念徽章
日期:2012-02-13 15:09:23
6#
发表于 2004-5-25 19:02 | 只看该作者
consistent gets 考虑transaction isolation level=serializable时的情况,就会理解的。

使用道具 举报

回复
论坛徽章:
2
授权会员
日期:2005-10-30 17:05:33会员2006贡献徽章
日期:2006-04-17 13:46:34
7#
 楼主| 发表于 2004-5-25 21:53 | 只看该作者
Bitty_rainy及各位同仁:多谢你们的回答。
可否这样理解呢:
Consistent Gets:(数据请求总数在回滚段Buffer中次数)
为了读一致性的而进行的数据块阅读的次数
DB Block Gets:(请求的数据块在buffer中能满足的个数)
为了能够看到即时更新的数据,而进行的数据块阅读的次数。

是括号内的正确吗?

使用道具 举报

回复
论坛徽章:
86
ITPUB元老
日期:2005-02-28 12:57:002012新春纪念徽章
日期:2012-01-04 11:49:542012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:20咸鸭蛋
日期:2012-05-08 10:27:19版主8段
日期:2012-05-15 15:24:112013年新春福章
日期:2013-02-25 14:51:24
8#
发表于 2004-5-25 22:05 | 只看该作者
db  block  gets 仅仅表达,即使有回滚段内容也不用去产生 before  image

consistent  get 仅仅表达,如果有回滚段内容并且block的变化的提交时间点晚于查询开始的时间点就要产生 before  image ,但只有满足这个条件的时候才产生(回滚),并不是说一定要回滚 或者 是从回滚段获取来的数据

使用道具 举报

回复
论坛徽章:
86
ITPUB元老
日期:2005-02-28 12:57:002012新春纪念徽章
日期:2012-01-04 11:49:542012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:20咸鸭蛋
日期:2012-05-08 10:27:19版主8段
日期:2012-05-15 15:24:112013年新春福章
日期:2013-02-25 14:51:24
9#
发表于 2004-5-25 23:23 | 只看该作者
最初由 Kamus 发布
[B][php]
KAMUS at ora10g>select * from t_test;

8192 rows selected.

Elapsed: 00:00:00.61

Execution Plan
----------------------------------------------------------
   0      SELECT STATEMENT Optimizer=ALL_ROWS (Cost=41 Card=8192 Bytes
          =16384)

   1    0   TABLE ACCESS (FULL) OF 'T_TEST' (TABLE) (Cost=41 Card=8192
           Bytes=16384)





Statistics
----------------------------------------------------------
          0  recursive calls
          0  db block gets
        731  consistent gets
        167  physical reads
          0  redo size
     126579  bytes sent via SQL*Net to client
       6518  bytes received via SQL*Net from client
        548  SQL*Net roundtrips to/from client
          0  sorts (memory)
          0  sorts (disk)
       8192  rows processed

[/php]

查询之前没有任何写操作,查询开始之后也没有
为什么全部是consistent gets? [/B]


再仔细读一读我的话?

这个仅仅表达 如果需要的话,就从回滚段来数据,如果不需要,就直接从当前buffer中获得

使用道具 举报

回复
论坛徽章:
2
授权会员
日期:2005-10-30 17:05:33会员2006贡献徽章
日期:2006-04-17 13:46:34
10#
 楼主| 发表于 2004-5-26 08:09 | 只看该作者
HI各位,现在初步理清这两个字段的含义!
可否进一步解释各个数字的含义,如何产生的呢
          3  db block gets
        73  consistent gets
例如:如何产生3个db block gets 和73个consistentgets?

使用道具 举报

回复

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

本版积分规则 发表回复

TOP技术积分榜 社区积分榜 徽章 团队 统计 知识索引树 积分竞拍 文本模式 帮助
  ITPUB首页 | ITPUB论坛 | 数据库技术 | 企业信息化 | 开发技术 | 微软技术 | 软件工程与项目管理 | IBM技术园地 | 行业纵向讨论 | IT招聘 | IT文档
  ChinaUnix | ChinaUnix博客 | ChinaUnix论坛
CopyRight 1999-2011 itpub.net All Right Reserved. 北京盛拓优讯信息技术有限公司版权所有 联系我们 未成年人举报专区 
京ICP备16024965号-8  北京市公安局海淀分局网监中心备案编号:11010802021510 广播电视节目制作经营许可证:编号(京)字第1149号
  
快速回复 返回顶部 返回列表