您好,登录后才能下订单哦!
前言:传统的数据库读取的方式是先在内存中搜索,如果搜索不到数据,那么就在把数据从磁盘读到内存中,然后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进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。