---会话1创建测试表并插入数据
SQL> create table t_network(a int);
Table created.
--构建索引,产生db file sequential read
SQL> create index idx_t_single on t_single(a);
Index created.
SQL> insert into t_network values(1);
1 row created.
SQL> commit;
Commit complete.
--会话 清空共享池,便于观察 db file sequential read
SQL> alter system flush shared_pool;
System altered
SQL> select event,total_waits,time_waited,average_wait from v$session_event where sid=1 order by total_waits desc;
EVENT TOTAL_WAITS TIME_WAITED AVERAGE_WAIT
---------------------------------------------------------------- ----------- ----------- ------------
db file sequential read 139 99 0.71 --此等待事件增大,是因为会读取与本话相关的一些字典表的数据
SQL*Net message to client 24 0 0
SQL*Net message from client 23 260608 11330.78
log file sync 5 0 0.09
Disk file operations I/O 4 0 0.06
events in waitclass Other 3 6 1.93
SQL*Net break/reset to client 2 0 0.01
enq: RO - fast object reuse 1 1 0.81
8 rows selected
---读取表记录
SQL> select * from t_single;
A
----------
1
2
---对比发现db file sequential read等待事件加大了
SQL> /
EVENT TOTAL_WAITS TIME_WAITED AVERAGE_WAIT
---------------------------------------------------------------- ----------- ----------- ------------
db file sequential read 142 104 0.73
SQL*Net message to client 26 0 0
SQL*Net message from client 25 263763 10550.52
log file sync 5 0 0.09
Disk file operations I/O 4 0 0.06
events in waitclass Other 3 6 1.93
SQL*Net break/reset to client 2 0 0.01
enq: RO - fast object reuse 1 1 0.81
8 rows selected
---表已在buffer cache中
SQL> /
A
----------
1
2
---对比发现如表已在buffer cache则db file sequential read不会增加
SQL> /
EVENT TOTAL_WAITS TIME_WAITED AVERAGE_WAIT
---------------------------------------------------------------- ----------- ----------- ------------
db file sequential read 142 104 0.73
SQL*Net message to client 28 0 0
SQL*Net message from client 27 280384 10384.58
log file sync 5 0 0.09
Disk file operations I/O 4 0 0.06
events in waitclass Other 3 6 1.93
SQL*Net break/reset to client 2 0 0.01
enq: RO - fast object reuse 1 1 0.81
8 rows selected
小结:
1,db file sequential read即服务器进程发出读取表记录所属的数据块时,如不在buffer cache,则调用io自物理磁盘把对应的数据块读取到buffer cache,服务器进程等待这个io动作完成的过程
2,所读取的数据块不在buffer cache而在物理磁盘上
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/9240380/viewspace-761570/ ,如需转载,请注明出处,否则将追究法律责任。