当一个session 是从磁盘直接读取buffer 到PGA(相对从buffer cache在SGA中),它在这个事件上等待。如果 I/O 子系统不能支持异步I/O,然后每个等待对应的物理读请求。如果 I/O 子系统支持异步I/O,那么处理是可以重叠执行读请求和处理blocks 已经存在在PGA里。当process 尝试访问一个block 在PGA中,没有从磁盘读取, 它然后执行一个等待请求和更新这个事件的统计信息。因此,等待的数量是和读请求的数量不一样的。Check the following V$SESSION_WAIT parameter columns: P1 - File_id for the read call 读取的文件id P2 - Start block_id for the read call 读取的启示块 P3 - Number of blocks in the read call 读取的块数产生的原因:direct path read较高的可能原因有: 1. 大量的磁盘排序操作,order by, group by, union, distinct, rollup, 无法在PGA中完成排序,需要利用temp表空间进行排序。 当从临时表空间中读取排序结果时,会产生direct path read. 2. 大量的Hash Join操作,利用temp表空间保存hash区。 3. SQL语句的并行处理 4. 大表的全表扫描,在中,全表扫描的算法有新的变化,根据表的大小、高速缓存的大小等信息,决定是否绕过SGA直接从磁盘读Oracle11g取数据。 而10g则是全部通过高速缓存读取数据,称为table scan(large)。11g认为大表全表时使用直接路径读,可能比10g中的数据文件散列读(db file scattered reads)速度更快,使用的latch也更少。11g 全表扫描等待事件为:direct path readSession 1:SQL> select * from v$mystat where rownum<2; SID STATISTIC# VALUE---------- ---------- ---------- 598 0 0SQL> select count(*) from tlyh; COUNT(*)---------- 48347648Session 2:SQL> select SESSION_ID, NAME, ash.sample_time, P1, P2, P3, WAIT_TIME, CURRENT_OBJ#, CURRENT_FILE#, CURRENT_BLOCK# from v$active_session_history ash, v$event_name enm where ash.event# = enm.event#and ash.session_id=1167 and rownum<10; 2 3 4 5 6 7 8 9 10 11 12 13 SESSION_ID NAME SAMPLE_TIME P1 P2 P3 WAIT_TIME CURRENT_OBJ# CURRENT_FILE# CURRENT_BLOCK#---------- ---------------------------------------- ------------------------------ ---------- ---------- ---------- ---------- ------------ ------------- -------------- 1167 direct path read 05-1月 -17 06.33.42.338 下午 7 147712 128 0 107793 7 147592 1167 direct path read 05-1月 -17 06.33.41.328 下午 5 228480 128 0 107793 5 228352 1167 direct path read 05-1月 -17 06.33.23.308 下午 6 498304 128 0 107793 6 498176 1167 direct path read 05-1月 -17 06.33.22.298 下午 6 331264 128 0 107793 6 331136 1167 direct path read 05-1月 -17 06.32.51.258 下午 6 288256 128 0 107793 6 288128P1 要读取的绝对文件号码P2 读取的起始块号P3 要读取的块数SQL> set linesize 200SQL> SQL> select owner, segment_name, segment_type from dba_extents where file_id = 6 and 498304 between block_id and block_id + blocks - 1; 2 3 4 5 OWNER SEGMENT_NAME SEGMENT_TYPE------------------------------ --------------------------------------------------------------------------------- ------------------VXSPACE TLYH TABLESQL> select owner, segment_name, segment_type from dba_extents where file_id = 5 and 228480 between block_id and block_id + blocks - 1; 2 3 4 5 OWNER SEGMENT_NAME SEGMENT_TYPE------------------------------ --------------------------------------------------------------------------------- ------------------VXSPACE TLYH TABLESQL> select owner, segment_name, segment_type from dba_extents where file_id = 7 and 147712 between block_id and block_id + blocks - 1; 2 3 4 5 OWNER SEGMENT_NAME SEGMENT_TYPE------------------------------ --------------------------------------------------------------------------------- ------------------VXSPACE TLYH TABLE select owner, segment_name, segment_type from dba_extents where file_id = 7 and 147712 between block_id and block_id + blocks - 1;
0 0