Oracle等待事件db file parallel read
SQL> select event#,name,parameter1,parameter2,parameter3 from v$event_name where name = 'db file parallel read'; EVENT# NAME PARAMETER1 PARAMETER2 PARAMETER3
---------- ------------------------------ --------------- --------------- ---------------
120 db file parallel read files blocks requests
1. db file parallel read
Contrary to what the name suggests, the db file parallel read event is not related to any parallel
operation—neither parallel DML nor parallel query. This event occurs during the database recovery
operation when database blocks that need changes as a part of recovery are read in parallel from the
datafiles. This event also occurs when a process reads multiple noncontiguous single blocks from
one or more datafiles.
Wait Parameters
Wait parameters for db file parallel read are described here:
l P1 Number of files to read from
l P2 Total number of blocks to read
l P3 Total number of I/O requests (the same as P2 since multiblock read is not used)
Wait Time
No timeouts. The session waits until all of the I/Os are completed.
案例
http://www.itpub.net/thread-1586802-1-1.html
虽然执行计划正确,但是由于index的聚合因子过高,导致prefetch功能大量预读取数据.
一个语句执行计划没有问题,单独提取出来执行只要0.8秒。但是放到存储过程中就很慢 需要10秒左右甚至更多。
Execution Plan
Id | Operation | Name | Rows | Bytes | Cost (%CPU) | Time |
0 | SELECT STATEMENT | 1839 (100) | ||||
1 | SORT AGGREGATE | 1 | 37 | |||
2 | FILTER | |||||
3 | TABLE ACCESS BY INDEX ROWID | V_RPT_PLYEDR_INSRNC | 1 | 37 | 1839 (1) | 00:00:23 |
4 | INDEX RANGE SCAN | ACIF_INDEX_001 | 2147 | 18 (0) | 00:00:01 |
但是带入数据单独这个语句执行计划一样的情况下,只要1秒左右。应该不是绑定变量导致的执行计划问题,因为可以看到执行计划是最优的,我查看了等待事件
491 db file parallel read 2041
491 db file sequential read 526
491 db file scattered read 23
SQL> select distinct(file_id) from dba_extents where segment_name='V_RPT_PLYEDR_INSRNC';
FILE_ID
----------
25
22 SQL> select name from v$datafile where file# in ('',''); NAME
--------------------------------------------------------------------------------
/repdata/ora9i/CIRCI.dbf
/repdata/ora9i/circi01.dbf
Top 5 Timed Events
Event | Waits | Time(s) | Avg Wait(ms) | % Total Call Time | Wait Class |
db file parallel read |
351,880 |
2,891 |
8 |
68.3 |
User I/O |
db file sequential read |
463,984 |
1,216 |
3 |
28.7 |
User I/O |
CPU time | 184 | 4.4 | |||
log file parallel write |
1,346 |
3 |
2 |
.1 |
System I/O |
db file parallel write |
512 |
3 |
6 |
.1 |
System I/O |
File IO Stats
- ordered by Tablespace, File
Tablespace | Filename | Reads | Av Reads/s | Av Rd(ms) | Av Blks/Rd | Writes | Av Writes/s | Buffer Waits | Av Buf Wt(ms) |
CIRCI | /repdata/ora9i/CIRCI.dbf |
2,847,514 |
787 |
12.59 |
1.02 |
1,258 |
0 |
3 |
20.00 |
CIRCI | /repdata/ora9i/circi01.dbf |
915,158 |
253 |
8.63 |
1.00 |
13 |
0 |
0 |
0.00 |
REPORT | /repdata/ora9i/REPORT01.dbf |
257,679 |
71 |
0.75 |
15.15 |
0 |
0 |
186,811 |
0.45 |
REPORT | /repdata/ora9i/REPORT02.dbf |
255,701 |
71 |
0.71 |
15.21 |
0 |
0 |
187,164 |
0.43 |
REPORT | /repdata/ora9i/REPORT03.dbf |
135,105 |
37 |
0.72 |
15.35 |
0 |
0 |
125,856 |
0.39 |
Av Rd(ms) 过大 排除 整列本生有问题,是否和 集群因子过大导致通过ROWID寻找TABLE ROWS时跳跃过大有关?
结果显示集群因子相当的大,表中一共3000多W调数据 集群因子达到2600W,但是索引的DISTINCT值确只有846,表只是批量的进行INSERT
所以是否可以考虑如下的方法
1、建立BITMAP索引代替以前爱的B-TREE索引
2、或者建立一个大的联合索引,让查询直接走INDEX FAST FULL SCAN。
3、同时建立一个新的表空间来存放索引,做好把TABLE也MOVE到新建的表空间中。
我已经建立了联合索引。效果灰常好。已经不通过TABLE ACCESS BY INDEX ROWID 了。只扫描索引就好了。
新的Execution Plan 如下:
PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------
Plan hash value: 2161530321
----------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
----------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 37 | 156 (1)| 00:00:02 |
| 1 | SORT AGGREGATE | | 1 | 37 | | |
|* 2 | INDEX RANGE SCAN| TEST01 | 2 | 74 | 156 (1)| 00:00:02 |
原理:
高聚簇因子 index range scan -----> 引发灰常多的 rowid 回表扫描离散的block ------>buffer prefetching(11G) ------------> db file parallel read...
当 db 出现过多的 db file parallel read 优化SQL 去吧。
案列二:
http://yangtingkun.net/?p=695 消除11.2上的db file parallel read
客户在11.2.0.3环境中进行压力测试,发现出现大量的db file parallel read等待事件。
这个等待是11g以后才出现的,而在11g以前,一般这个等待事件发生在数据文件的恢复过程中。而11g新增了prefetch的特性,也可能导致这个等待事件的产生。
当运行压力测试时,后台的等待事件如下:
SQL> SELECT event, COUNT(*) FROM v$session WHERE username = USER GROUP BY event ORDER BY 2;
EVENT COUNT(*)
---------------------------------------------------------------- ----------
SQL*Net message FROM client 1
SQL*Net message TO client 1
db file sequential READ 24
db file scattered READ 33
db file parallel READ 42
可以看到用户进程经历比较严重的IO等待,而此时的db file parallel read,并不会带来性能提升。
可以通过添加隐含参数的方法来屏蔽prefetch功能,从而避免db file parallel read等待事件的产生:
_db_block_prefetch_limit=0
_db_block_prefetch_quota=0
_db_file_noncontig_mblock_read_count=0
修改这三个隐藏参数后,发现db file parallel read等待事件已经消失:
SQL> SELECT event, COUNT(*) FROM v$session WHERE username = USER GROUP BY event ORDER BY 2;
EVENT COUNT(*)
---------------------------------------------------------------- ----------
SQL*Net message TO client 1
db file scattered READ 30
db file sequential READ 70
Oracle等待事件db file parallel read的更多相关文章
- ORACLE等待事件: log file parallel write
log file parallel write概念介绍 log file parallel write 事件是LGWR进程专属的等待事件,发生在LGWR将日志缓冲区(log_buffer)中的重做日志 ...
- Oracle 等待事件 db file sequential read
db file sequential read-数据文件顺序读取 等待事件: "db file sequential read" Reference Note (文档 ID 345 ...
- 等待事件--db file sequential read
对于最小化db file sequential read 事件所带来的影响,你可以做的另一件事情是减少AVERAGE_WAIT时间. 这是会话必须等待从磁盘提取单块的平均时间,这些信息可以从v$ses ...
- I/O等待事件-db file scattered read
摘自:http://blog.csdn.net/zq9017197/article/details/7925338
- ORACLE等待事件:read by other session
read by other session简介 官方关于read by other session的介绍如下: When information is requested from the datab ...
- 全面解析Oracle等待事件的分类、发现及优化
一.等待事件由来 大家可能有些奇怪,为什么说等待事件,先谈到了指标体系.其实,正是因为指标体系的发展,才导致等待事件的引入.总结一下,Oracle的指标体系,大致经历了下面三个阶段: · 以命中率为主 ...
- Oracle db file parallel write 和 log file parallel write 等待事件
一. db file parallel write等待事件 引自如下blog: http://oradbpedia.com/wiki/Wait_Events_-_db_file_parallel_wr ...
- Oracle等待事件之db file sequential read/ db file parallel read
1.产生原因 db file sequential read这个是非常常见的I/O 相关的等待事件.表示发生了与索引扫描相关的等待.意味着I/O 出现了问题,通常表示I/O竞争或者I/O 需求太多. ...
- [20180316]理解db file parallel read等待事件.txt
[20180316]理解db file parallel read等待事件.txt --//一直对db file parallel read等待事件不理解,因为在实际系统中很少遇到这样的等待事件. S ...
随机推荐
- mysql修改默认编码为UTF8
Linux下一般是 /etc/my.cnf --在 [mysqld] 标签下加上三行default-character-set = utf8character_set_server = utf8 -- ...
- [杂谈] My Wikipedia
// 此博文为迁移而来,写于2015年6月8日,不代表本人现在的观点与看法.原始地址:http://blog.sina.com.cn/s/blog_6022c4720102w3de.html
- JS中toFixed()方法的问题及解决方案
最近发现JS当中toFixed()方法存在一些问题,采用原生的Number对象的原型对象上的toFixed()方法时,规则并不是所谓的“四舍五入”或者是“四舍六入五成双”,所谓“四舍六入五成双”,在百 ...
- css切背景图片(background-position)
给元素添加背景图片的方式有很多,个人总结的有: 用img插入图片: css3的方式手动绘图: 单独用background-image单独插入图片: 其中用background-image有两种方法,一 ...
- Xcode的command+shift+o是一个不错的工具
一,经历 1.在向UITextField中输入图片的时候,可以使用 NSAttributedString 添加,但是很难找到能够返回NSAttributedString对象的方法. 2.通过comma ...
- Bone Collector(01背包)
题目链接:http://acm.hust.edu.cn/vjudge/contest/view.action?cid=87125#problem/N 题目: Description Many year ...
- Button,CheckBox,Lable,RadioButton,ComboBox,TextBox六个简单控件的使用
所有文字的更改全部在Text属性中更改! ComboBox:点击右上方小箭头,选择编辑项弹出: RadioButton:,Checked属性选择True,表示已被选中: Button:在设计中双击按钮 ...
- windows 给ping加时间
@echo off set /p host=host Address: set logfile=Log_%host%.log echo Target Host = %host% >%logfil ...
- fn标签常用方法使用说明
需要jstl.jar包,然后在jsp页头导入 <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix=& ...
- hadoop Error: JAVA_HOME is not set and could not be found.
Hadoop安装完后,启动时报Error: JAVA_HOME is not set and could not be found.解决办法: 修改/etc/hadoop/hadoop- ...