dbfilesequentialread等待事件
今天是2014-01-08,继续完成等待事件系列。 什么是:db file sequential read:? 简单说,就是oracle要读取单块数据,其他会话存在等待,有三个参数p1,是要读的文件,p2是block#,开始读取的数据块号,p3是blocks,一般p3为单块,但是如果是多块那么一般发
今天是2014-01-08,继续完成等待事件系列。
什么是:db file sequential read:?
简单说,就是oracle要读取单块数据,其他会话存在等待,有三个参数p1,是要读的文件,p2是block#,开始读取的数据块号,p3是blocks,一般p3为单块,但是如果是多块那么一般发生在从temporary segment中读的。
该类等待事件的出现主要是由于执行对索引,回滚(undo)段,和表(当借助rowid来访问),控制文件和数据文件头的单块读操作SQL语句(用户和递归)引起的,该事件的产生要么表的连接顺序有问题,要么索引使用不当导致。
如何解决呢:
1、优化sql,主要是看执行计划,能不走全表的就不走全表(但是有时候全表可能比索引更快),能走index scan的就不走table access byindex rowid.
2、增加file的i/0速率,一般对于硬件存储设备而言,数据文件所在的磁盘采用哪种raid也是很显著
3、增加buffer cache大小,使其数据在内存中得到,但是到了10G、11g 启用了asmm和amm那么buffer cache是会动的,或者考虑将相关表存放到keep 池中,如果是11g可以考虑result cache。
4、可以将数据放到非标准块中(大块存多行数据),避免i/0
5、采用索引组织表,减少i/o
6、采用并行查询执行(占用一定内存和cpu,需要依据主机负载判断)
7、可以尝试采用分区表等。
案例分析:
1、获得sql信息如下:
SELECTcount(1)
FROMWF_DEAL_COMMON_MAIN_T M,
WFC_ROOT_SUB_RELATION_T R,
RT_WORKITEMINST W
WHERE M.F_PROCINST_ID = R.ROOT_ID
AND R.SUB_ID =W.PROC_INSTANCE_ID
AND W.current_statein (1,2)
AND W.USER_ID = :1
AND W.OVERDUED = :2
查看执行计划如下:
>SELECT count(1)
16:02:35 2 FROM WF_DEAL_COMMON_MAIN_T M,
16:02:35 3 WFC_ROOT_SUB_RELATION_T R,
16:02:35 4 RT_WORKITEMINST W
16:02:35 5 WHERE M.F_PROCINST_ID = R.ROOT_ID
16:02:35 6 AND R.SUB_ID = W.PROC_INSTANCE_ID
16:02:35 7 AND W.current_state in (1, 2)
16:02:36 8 AND W.USER_ID = 999
16:02:36 9 AND W.OVERDUED = 1
16:02:36 10 ;
Predicate Information (identified by operation id):
---------------------------------------------------
4 -filter(("W"."CURRENT_STATE"=1 OR"W"."CURRENT_STATE"=2) AND"W"."OVERDUED"=1 AND
TO_NUMBER("W"."USER_ID")=999)
6 -access("R"."SUB_ID"="W"."PROC_INSTANCE_ID")
filter("R"."SUB_ID"="W"."PROC_INSTANCE_ID")
8 -access("M"."F_PROCINST_ID"="R"."ROOT_ID")
Note
-----
- dynamic samplingused for this statement
index full scan,table access full。注意此时有隐式转换。
如果把变量换成字符串。执行计划如下:
>r
1 SELECT count(1)
2 FROM WF_DEAL_COMMON_MAIN_T M,
3 WFC_ROOT_SUB_RELATION_T R,
4 RT_WORKITEMINST W
5 WHERE M.F_PROCINST_ID = R.ROOT_ID
6 AND R.SUB_ID = W.PROC_INSTANCE_ID
7 AND W.current_state in (1, 2)
8 AND W.USER_ID ='999'
9* AND W.OVERDUED = 2
Predicate Information (identified by operation id):
---------------------------------------------------
4 -filter(("W"."CURRENT_STATE"=1 OR"W"."CURRENT_STATE"=2) AND"W"."OVERDUED"=2)
5 -access("W"."USER_ID"='640001312')
7 -access("R"."SUB_ID"="W"."PROC_INSTANCE_ID")
8 -access("M"."F_PROCINST_ID"="R"."ROOT_ID")
Note
-----
- dynamicsampling used for this statement
总结:
从如上内容,可以分析得出:因为w.user_id为varchar 类型,当w.user_id赋值为数字则会产生index full scan和table access full,这主要是由于隐式转换导致,解决该办法一种是建立函数索引,另一种是在传送该值变量的时候进行转换。建议采用后者。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



PHP sends emails asynchronously: avoid long waits for emails to be sent. Introduction: In web development, sending emails is one of the common functions. However, since sending emails requires communication with the server, it often causes users to wait for a long time while waiting for the email to be sent. In order to solve this problem, we can use PHP to send emails asynchronously to optimize the user experience. This article will introduce how to implement PHP to send emails asynchronously through specific code examples and avoid long waits. 1. Understanding sending emails asynchronously
![Event ID 4660: Object deleted [Fix]](https://img.php.cn/upload/article/000/887/227/168834320512143.png?x-oss-process=image/resize,m_fill,h_207,w_330)
Some of our readers encountered event ID4660. They're often not sure what to do, so we explain it in this guide. Event ID 4660 is usually logged when an object is deleted, so we will also explore some practical ways to fix it on your computer. What is event ID4660? Event ID 4660 is related to objects in Active Directory and will be triggered by any of the following factors: Object Deletion – A security event with Event ID 4660 is logged whenever an object is deleted from Active Directory. Manual changes – Event ID 4660 may be generated when a user or administrator manually changes the permissions of an object. This can happen when changing permission settings, modifying access levels, or adding or removing people or groups

On iPhones running iOS 16 or later, you can display upcoming calendar events directly on the lock screen. Read on to find out how it's done. Thanks to watch face complications, many Apple Watch users are used to being able to glance at their wrist to see the next upcoming calendar event. With the advent of iOS16 and lock screen widgets, you can view the same calendar event information directly on your iPhone without even unlocking the device. The Calendar Lock Screen widget comes in two flavors, allowing you to track the time of the next upcoming event, or use a larger widget that displays event names and their times. To start adding widgets, unlock your iPhone using Face ID or Touch ID, press and hold

When a value is added to the input box, the oninput event occurs. You can try running the following code to understand how to implement oninput events in JavaScript - Example<!DOCTYPEhtml><html> <body> <p>Writebelow:</p> <inputtype="text"

How to implement calendar functions and event reminders in PHP projects? Calendar functionality and event reminders are one of the common requirements when developing web applications. Whether it is personal schedule management, team collaboration, or online event scheduling, the calendar function can provide convenient time management and transaction arrangement. Implementing calendar functions and event reminders in PHP projects can be completed through the following steps. Database design First, you need to design a database table to store information about calendar events. A simple design could contain the following fields: id: unique to the event

jQuery is a popular JavaScript library that can be used to simplify DOM manipulation, event handling, animation effects, etc. In web development, we often encounter situations where we need to change event binding on select elements. This article will introduce how to use jQuery to bind select element change events, and provide specific code examples. First, we need to create a dropdown menu with options using labels:

Commonly used events in jquery are: 1. Window events; 2. Mouse events, which are events generated when the user moves or clicks the mouse on the document, including mouse clicks, move-in events, move-out events, etc.; 3. Keyboard events, Events are generated every time the user presses or releases a key on the keyboard, including key press events, key release events, etc.; 4. Form events, such as the focus() event will be triggered when an element gains focus, and the focus() event will be triggered when it loses focus. The blur() event is triggered, and the submit() event is triggered when the form is submitted.

Methods for building event-based applications in PHP include using the EventSourceAPI to create an event source and using the EventSource object to listen for events on the client side. Send events using Server Sent Events (SSE) and listen for events on the client side using an XMLHttpRequest object. A practical example is to use EventSource to update inventory counts in real time in an e-commerce website. This is achieved on the server side by randomly changing the inventory and sending updates, and the client listens for inventory updates through EventSource and displays them in real time.
