關於統計中Consistent Gets,Physical Reads和DB Block Gets的意義

litterbaby發表於2007-04-01
關於統計中Consistent Gets,Physical Reads和DB Block Gets的意義[@more@]

Consistent GetsPhysical ReadsDB Block Gets的意義

這個問題,我似乎找了很多遍,也記了很多遍,似乎現在還是搞的比較迷糊,今天看到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'。當在記憶體中不存在所需要的資料塊的話就需要從磁碟中獲取,這就產生了磁碟讀。

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/222350/viewspace-907914/,如需轉載,請註明出處,否則將追究法律責任。

相關文章