您好,登錄后才能下訂單哦!
前言:傳統的數據庫讀取的方式是先在內存中搜索,如果搜索不到數據,那么就在把數據從磁盤讀到內存中,然后PGA再中SGA中獲取數據,這樣數據就緩存到內存中了,下次再次訪問的時候,就可以直接從SGA中獲取,不用再進行物理讀;
direct path read(直接路徑讀):直接路徑讀是違反傳統的數據讀取方式的,指服務器進程直接讀取數據文件到PGA的內存,不經過buffer cache,以下是數據庫讀取數據的三種方式;
官方說明介紹: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
直接路徑讀的優勢:存在即合理,相信這個算法的產生也肯定是有原因的;
總結優勢如下:
1、采用直接路徑讀取后,總能保證讀取的塊數是多塊讀參數設置的大小,提高了讀取的效率;
2、大大的降低了對于latch的使用,進而避免了可能導致的latch競爭(cbc latch等);
3、降低了全表掃描對buffer cache的沖擊;
4、降低了buffer pin的開銷,有可能降低buffer busy waits等相關等待;
當然這種方法也是有副作用的:
1、會發生段一級的檢查點(后面詳細介紹),因此在查詢真正開始執行前,會做這個額外的準備工作。而且可能會造成IO抖動,因為要寫臟數據;
2、如果你的表需要頻繁的全表掃描讀取,還是用傳統的讀取方式比較好;
3、在MOS中搜索direct path read,會發現它可能會導致多次的延遲塊清除;
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
本文作者:JOHN
ORACLE技術博客:ORACLE 獵人筆記 數據庫技術群:367875324 (請備注ORACLE管理 )
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。