溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

direct path read直接路徑讀

發(fā)布時間:2020-08-08 08:11:06 來源:ITPUB博客 閱讀:249 作者:Davis_itpub 欄目:關(guān)系型數(shù)據(jù)庫

前言:傳統(tǒng)的數(shù)據(jù)庫讀取的方式是先在內(nèi)存中搜索,如果搜索不到數(shù)據(jù),那么就在把數(shù)據(jù)從磁盤讀到內(nèi)存中,然后PGA再中SGA中獲取數(shù)據(jù),這樣數(shù)據(jù)就緩存到內(nèi)存中了,下次再次訪問的時候,就可以直接從SGA中獲取,不用再進行物理讀;

direct path read(直接路徑讀):直接路徑讀是違反傳統(tǒng)的數(shù)據(jù)讀取方式的,指服務(wù)器進程直接讀取數(shù)據(jù)文件到PGA的內(nèi)存,不經(jīng)過buffer cache,以下是數(shù)據(jù)庫讀取數(shù)據(jù)的三種方式;direct path read直接路徑讀

官方說明介紹:When a session is reading buffers from disk directly into the PGA (opposed to the buffer cache in SGA), it waits on this event. If the I/O subsystem does not support asynchronous I/Os, then each wait corresponds to a physical read request.

 If the I/O subsystem supports asynchronous I/O, then the process is able to overlap issuing read requests with processing the blocks existing in the PGA. When the process attempts to access a block in the PGA that has not yet been read from disk, it then issues a wait call and updates the statistics for this event. Hence, the number of waits is not necessarily the same as the number of read requests (unlike db file scattered read and db file sequential read).

 Check the following V$SESSION_WAIT parameter columns:

 ?P1: File_id for the read call

 ?P2: Start block_id for the read call

 ?P3: Number of blocks in the read call

直接路徑讀的優(yōu)勢:存在即合理,相信這個算法的產(chǎn)生也肯定是有原因的;

總結(jié)優(yōu)勢如下:

1、采用直接路徑讀取后,總能保證讀取的塊數(shù)是多塊讀參數(shù)設(shè)置的大小,提高了讀取的效率;

2、大大的降低了對于latch的使用,進而避免了可能導(dǎo)致的latch競爭(cbc latch等);

3、降低了全表掃描對buffer cache的沖擊;

4、降低了buffer pin的開銷,有可能降低buffer busy waits等相關(guān)等待;

 

當(dāng)然這種方法也是有副作用的:

1、會發(fā)生段一級的檢查點(后面詳細介紹),因此在查詢真正開始執(zhí)行前,會做這個額外的準(zhǔn)備工作。而且可能會造成IO抖動,因為要寫臟數(shù)據(jù);

2、如果你的表需要頻繁的全表掃描讀取,還是用傳統(tǒng)的讀取方式比較好;

3、在MOS中搜索direct path read,會發(fā)現(xiàn)它可能會導(dǎo)致多次的延遲塊清除;

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

本文作者:JOHN

ORACLE技術(shù)博客:ORACLE 獵人筆記               數(shù)據(jù)庫技術(shù)群:367875324 (請備注ORACLE管理 )  

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

向AI問一下細節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI