分类: Oracle
2009-12-18 01:10:30
这个问题,我似乎找了很多遍,也记了很多遍,似乎现在还是搞的比较迷糊,今天看到ITPUB上的一个帖子
http://www.itpub.net/showthread.php?s=9650d33f292c0cc948b9fb9ce80047f0&threadid=605100
好好总结一下:
在Oracle的文档中有这样的解释:
db block gets |
Number of times a CURRENT block was requested. |
consistent gets |
Number of times a consistent read was requested for a block. |
physical reads |
Total number of data blocks read from disk. This number equals the value of "physical reads direct" plus all reads into buffer cache. |
· 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.
(DB Block Gets:请求的数据块在buffer能满足的个数)
当前模式块意思就是在操作中正好提取的块数目,而不是在一致性读的情况下而产生的块数。正常的情况下,一个查询提取的块是在查询开始的那个时间点上存在的数据块,当前块是在这个时刻存在的数据块,而不是在这个时间点之前或者之后的数据块数目。
· 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.
(Consistent Gets:数据请求总数在回滚段Buffer中的数据一致性读所需要的数据块)
这里的概念是在处理你这个操作的时候需要在一致读状态上处理多少个块,这些块产生的主要原因是因为由于在你查询的过程中,由于其他会话对数据块进行操作,而对所要查询的块有了修改,但是由于我们的查询是在这些修改之前调用的,所以需要对回滚段中的数据块的前象进行查询,以保证数据的一致性。这样就产生了一致性读。
· Physical Reads. Total number of data blocks read from disk. This number equals the value of "physical reads direct" plus all reads into buffer cache. (Physical Reads:实例启动后,从磁盘读到Buffer Cache数据块数量)
物理读:就是从磁盘上读取数据块的数量,这里主要产生的原因是因为:
1、 在数据缓存中没有存在这些块
2、 全表扫描
3、 磁盘排序
三者之间的关系:
逻辑读是指的是Oracle从内存中读到的数据块的数量。一般而言是'consistent gets' + 'db block gets'。当在内存中不存在所需要的数据块的话就需要从磁盘中获取,这就产生了磁盘读。