`
445822357
  • 浏览: 740594 次
文章分类
社区版块
存档分类
最新评论

High Waits on 'Db File Sequential Read' Due to Table Lookup Following Index Access

 
阅读更多

最近某些系统AWR的top 5中“Db File Sequential Read”占据的时间百分比非常大,通常这种等待事件是一种正常的。但当前系统性能是有些问题的,并发量大,有些缓慢,因此需要判断这种等待事件是否能够减少。MOS有几篇关于这种等待事件的介绍,这是其中一篇。


High Waits on 'Db File Sequential Read' Due to Table Lookup Following Index Access (文档 ID 875472.1)

即使执行计划已经是最优的了,但一次查询仍能够等待“db file sequential read'”这种事件很长的时间。通常是因为索引扫描的结果集非常大。例如:

SELECT D
FROM BIG_TABLE
WHERE A = 1253
AND B in ('CA', 'CO')
AND C > 210 ;

Rows    Row Source Operation
------- ---------------------------------------------------
 215431 TABLE ACCESS BY INDEX ROWID BIG_TABLE (cr=880191 pr=430780 pw=0 time=2293667056 us) <<<
3582275  INDEX RANGE SCAN BIG_TABLE_IDX (cr=664748 pr=218595 pw=0 time=352506821 us)

Elapsed times include waiting on following events:
  Event waited on                             Times   Max. Wait  Total Waited
  ----------------------------------------   Waited  ----------  ------------
  SQL*Net message to client                   14363        0.00          0.02
  db file sequential read                    461688        1.15       2254.55 <<<
  SQL*Net message from client                 14363        0.01          9.77
  SQL*Net break/reset to client                   1        0.00          0.00
...

在大多数这样的例子中,执行查询语句在“TABLE ACCESS BY INDEX ROWID”上的等待要比INDEX SCAN上需要更多的。这是因为随机访问表行的代价要比索引扫描更大。


为此,可以有以下几种方法调试:

1. 检查是否有更好的索引或执行计划。可能需要重新设计索引。

2. 尝试全表扫描。全表扫描通常比索引扫描要快,尽管CBO成本比索引扫描的成本高。

SELECT /*+ FULL(BIG_TABLE) */ D
FROM BIG_TABLE
WHERE A = 1253
AND B in ('CA', 'CO')
AND C > 210 ;

3. 如果仅仅有很少的列出现在SELECT和WHERE子句中,可以考虑为查询创建一个复合索引避免回表。

例如:

CREATE INDEX <INDEX_NAME> ON BIG_TABLE (A, B, C, D);

注意:仅针对SELECT语句有效。如果是UPDATE语句,这种做法可能没用。

4. 将表移动到更大block块大小的表空间。更大的block块会有更多的行,所以对减少block块IO会有帮助。重新组织表也会有帮助,因为这样做可以让索引有一个更小的clustering聚类因子。

5. 可以考虑增加buffer cache的大小,以至于可以缓存更多的块大小。如果表是频繁访问的,使用keep buffer池也是一个不错的选择。

6. 考虑使用IOT(索引组织表)。IOT可能减少IO,原因就是他会将数据存储于一个B树索引结构。例如,如果A列是表BIG_TABLE的主键,可以按照如下方法创建IOT:

create table BIG_TABLE (A number primary key, B char(2), C number, D varchar2(10))organization index;

7. 如果服务器有足够的空闲资源(CPU,内存),考虑使用并行执行。这种方式不会减少IO,但是有助于降低执行时间。

8. 较差的磁盘IO也可能是一个原因。可以提高表所在磁盘设备的IO。这可能需要系统管理员的协助。

分享到:
评论

相关推荐

    Db+file+sequential+read

    The db file sequential read Oracle metric event signifies that the user process is reading buffers into the SGA buffer cache and is waiting for a physical I/O call to return. This call differs from a...

    数据库性能监控

    db file sequential read(ms) log file parallel write(ms) log file sync(ms) db file scattered read(ms) #IO WorkLoad Oracle IOPS Oracle MBPS db file sequential read db file scattered read log file ...

    Oracle等待事件说明一

    buffer busy waits db file parallel write db file single write db file scattered read db file sequential read diret path write/read enqueue

    datastage Sequential File Stage

    自己总结的关于datastage sequential stage属性的说明。希望对各位同志有用,如果有不对的地方请多多指教。

    01 SequentialFile.rar

    严蔚敏数据结构与算法▲课本算法实现

    【故障处理】队列等待之TX 等待事件处理.docx

    队列等待之TX - allocate ITL entry引起的死锁处理 ...Db file sequential read异常等待事件分析与处理。 Db file scattered read异常等待事件分析与处理。 Direct path read异常等待事件分析与处理。

    Online Learning and Sequential Anomaly Detection in Trajectories

    limitations: They are not designed for sequential analysis of incomplete trajectories or online learning based on an incrementally updated training set. Moreover, they typically involve tuning of many...

    DB2 9 for z/OS

    improvements in disk access can reduce the time for sequential disk access and improve data rates. The key DB2 9 for z/OS performance improvements include reduced CPU time in many utilities, deep ...

    Introduction to DS——H1B Prediction based on Sequential.ipynb

    Introduction to DS——H1B Prediction based on Sequential.ipynb

    序列蒙特卡洛算法(粒子滤波)On sequential Monte Carlo sampling methods for Bayesian filtering

    On sequential Monte Carlo sampling methods for Bayesian filtering,一篇比较经典的介绍序列蒙特卡洛算法的论文

    oracle 常见等待事件及处理方法

    看书笔记db file scattered read DB ,db file sequential read DB,free buffer waits,log buffer space,log file switch,log file sync 我们可以通过视图v$session_wait来查看系统当前的等待事件,以及与等待事件相...

    Sequential Analysis - Hypothesis Testing and Changepoint Detection

    时间序列分析——The main focus of this book is on a systematic development of the theory of sequential hypothesis testing (Part I) and changepoint detection (Part II). In Part III, we briefly describe...

    Sequential.Logic.and.Verilog.HDL.Fundamentals.pdf

    Sequential Logic and Verilog HDL Fundamentals discusses the analysis and synthesis of synchronous and asynchronous sequential machines. These machines are implemented using Verilog Hardware ...

    Context_aware Sequential Recommender

    Since sequential information plays an important role in modeling user behaviors, various sequential recom- mendation methods have been proposed. Methods based on Markov assumption are widely-used, but...

    Index-sequential-file-organisation

    索引顺序文件组织该程序是针对主题数据库结构而准备的。目录关于该项目该项目的目的是设计和实现索引文件的组织。 该项目实现了索引顺序文件的组织。 已实现以下操作:插入,更新,读取,删除记录,显示数据文件和...

    squashfs2.2-r2.tar.gz

    root owned filesystems to be built without root access on the host machine. The "-force-uid uid" option forces all files in the generated Squashfs filesystem to be owned by the specified uid. The uid...

    An Introduction to Programming with C++

    ChaptEr 14 Sequential access Files 511 ChaptEr 15 Classes and Objects 551 appEndix a C++ keywords 593 appEndix B aSCii Codes 595 appEndix C Common Syntax errors 597 appEndix d How To Boxes 599 index ...

    Processor Arch-Sequential

    Processor Arch-Sequential

    Indexed-sequential-table.zip_Table_site:www.pudn.com

    索引表是一张指示逻辑记录和物理记录之间对应关系的表。索引表中的每项称作索引项。索引项是按键(或逻辑记录号)顺序排列。若文件本身也是按关键字顺序排列,则称为索引顺序文件。否则,称为索引非顺序文件。

Global site tag (gtag.js) - Google Analytics