- 浏览: 80314 次
- 性别:
- 来自: 北京
最新评论
-
streamsong:
王雨尘 写道
的确是说索引是排序的,我漏掉啦
我们为什么要用索引,用索引为什么比不用索引快 -
heerwa:
...
我们为什么要用索引,用索引为什么比不用索引快 -
liulanghan110:
那么用索引为什么会提高性能呢?因为索引(以B树索引为例)是树状 ...
我们为什么要用索引,用索引为什么比不用索引快 -
王雨尘:
我们为什么要用索引,用索引为什么比不用索引快 -
pangpang514:
居然和强哥合影过。。。。佩服!
我们为什么要用索引,用索引为什么比不用索引快
关于read by other session,db file scattered read,db file sequential read等待时间的优化(下)
- 博客分类:
- oracle
5tt2k7djxub2m |
select t.unionorderid as serialid , t.lotteryid as lotteryid , fn_get_lotteryname(t.lotteryid) as lotterydesc , t.lotteryissue as issue , fn_get_username(t.uuid) as username , to_char(t.addtime, 'yyyy-mm-dd hh24:mi') as createtime , case when t.schstatus=1 and t.currentvalue<t.schemevalue and t.endtime>sysdate then fn_get_schstatusdesc(0) else fn_get_schstatusdesc(t.schstatus) end as schstatusdesc , to_char(t.bonustime, 'yyyy-mm-dd hh24:mi') as bonustime , t.bonusvalue as bonusvalue , t.schemevalue as lotteryvalue , case when t.schstatus=1 and t.currentvalue<t.schemevalue and t.endtime>sysdate then 0 else t.schstatus end as schstatus , case when t.schemeissue>1 then 1 else 0 end as issueflag , t.bonusstop as bonusstop , t.schemeissue as schemeissue , t.schtype as schtype , t.schemetitle as schemetitle , t.schemmemo as schemedesc , t.viewtype as viewtypedesc , t.schembonusrate as bon usrate , t.limitvalue as limitvalue , t.schemlowmoney as schemelowvalue , t.currentvalue as buyvalue , t.bodivalue as baodivalue , case when t.saletype=-1 and t.childtype=-1 then fn_get_saletypedesc(t.lotteryid, t.saletype, t.childtype) else fn_get_childtypedesc(t.lotteryid , t.childtype)||fn_get_saletypedesc(t.lotteryid, t.saletype, t.childtype) end as saletypedesc , fn_get_passbonus(t.unionorderid) as passbonus , case when t.viewtype=0 then t.schdetail when t.viewtype=1 and t.endtime<sysdate and t.uuid!='' then t.schdetail when t.uuid='' then t.schdetail when t.viewtype=3 and fn_check_schfollow(t.unionorderid, '')=1 then t.schdetail when t.viewtype=4 and fn_check_schfollow(t.unionorderid, '')=1 and t.endtime<sysdate and t.uuid!='' then t.schdetail else 'nulls' end as schdetail , t.schnumbers as schnumbers , fn_get_lotterylevelid(t.uuid, t.lotteryid) as lotterylevel , fn_get_buyvalues(t.unionorderid, t.uuid) as schbuyvalue , to_cha r(t.endtime, 'yyyy-mm-dd hh24:mi') as endtime , lotterynumbers , istop from (select a.*, rownum r from (select a.* from tb_lotteryschemeinfo a inner join tb_lottery_info b on a.lotteryid=b.lotteryid and a.lotteryissue=b.lotteryissue where 1=1 and b.status<1 and a.schtype in (2, 3) and a.agenterid=10000001 order by a.istop desc, case when a.schstatus>2 then 5 when a.schstatus=2 then 4 when a.schstatus=1 and a.currentvalue<a.schemevalue and a.endtime>sysdate then 0 when a.schstatus=0 and a.currentvalue<a.schemevalue then 0 else 1 end, a.currentvalue/a.schemevalue desc, a.bodivalue/a.schemevalue desc, a.schemevalue desc , (a.schemevalue-a.currentvalue-a.bodivalue) desc, fn_get_lottery levelid(a.uuid, a.lotteryid) desc ) a where rownum <= 16) t where t.r > 0 |
首先想到的是查看算起来的执行计划,先看sql_id为0ygf63rbau963的sql
SQL> set line 1200
SQL>set autotrace traceonly explain
SQL> set timing on
SQL> select * from ( select row_.*, rownum rownum_ from ( select this_.ID as ID3_0_, this_.ART_ID as ART2_3_0_, this_.COM_CONTENT as COM3_3_0_, this_.COM_NAME as COM4_3_0_, this_.COM_TIME as COM5_3_0_, this_.TZZ_ID as TZZ6_3_0_ from ZHCWSQ.TZZ_ARTICLE_COMMENT this_ where this_.ART_ID=662 order by this_.ID desc ) row_ where rownum <=11) where rownum_ >5;
no rows selected
Elapsed: 00:04:23.01
Execution Plan
--------------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)|
--------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 11 | 22990 | 9683 (1)|
| 1 | VIEW | | 11 | 22990 | 9683 (1)|
| 2 | COUNT STOPKEY | | | | |
| 3 | VIEW | | 12 | 24924 | 9683 (1)|
| 4 | TABLE ACCESS BY INDEX ROWID| TZZ_ARTICLE_COMMENT | 810 | 2023K| 9683 (1)|
| 5 | INDEX FULL SCAN DESCENDING| PK_TZZ_ARTICLE_COMMENT | 10860 | | 30 (0)|
--------------------------------------------------------------------------------------------
看到这个sql走的是索引,但是4分23秒才查完76万条记录的表,这让我想到了db file sequential read等待事件,可能是因为这张表的索引建立的不正确,查看这张表的索引信息
SQL> set autotrace off
SQL>selectINDEX_OWNER,INDEX_NAME,TABLE_OWNER,TABLE_NAME,COLUMN_NAME from dba_ind_columns where table_name='TZZ_ARTICLE_COMMENT';
INDEX_OWNER INDEX_NAME TABLE_OWNE TABLE_NAME COLUMN_NAM
----------- ---------------------- ---------- ----------------- -----------
ZHCWSQ PK_TZZ_ARTICLE_COMMENT ZHCWSQ TZZ_ARTICLE_COMMENT ID
发现这张表只有ID字段有索引,而查询用到的where条件的字段ART_ID并没有索引,执行计划中走的是INDEX FULL。
通过观察sql_id为7pn5pxb6sdusu的sql也是这种情况。
再看下sql_id为5tt2k7djxub2m的大sql,还是看下索引情况
SQL> select * from dba_indexes where table_name='TB_LOTTERYSCHEMEINFO';
no rows selected
SQL> select * from user_ind_columns where table_name='TB_LOTTERYSCHEMEINFO';
no rows selected
发现这个表竟然没有索引
现在已将情况向领导反映,等领导要求优化的时候建立相应的索引,在看下统计信息和执行计划,由于是生产环境,未经批准,不能操作,真急人啊。
发表评论
-
将博客搬至CSDN
2013-12-06 15:49 56将博客搬至CSDN -
博客地址更换通知
2012-09-29 09:23 610自2011年8月,博客使用新地址www.dbdream.org ... -
如何追踪其他SESSION会话信息
2012-02-21 20:35 1301今天测试说在加载条目数据、校验数据和质检数据的时候很慢, ... -
SHM不足导致导致数据库宕机
2012-02-21 20:17 1253今天早上到办公室,开发说测试环境应用程序挂掉,看日志说是连接不 ... -
PCTFREE和PCTUSED及将LOB存到行外
2012-02-17 11:14 1445今天的ADDM报告建议重建存放图片的表并增大PCTFREE,这 ... -
SGA_TARGET大于SGA_MAX_SIZE的真实案例
2012-02-17 11:05 1360今天在给库户数据库健康检查的时候,发现个很奇怪的问题,S ... -
利用闪回、logmnr找回误删除的数据
2011-10-25 23:54 1264朋友遇到了非常经典的ORACLE事故——误删除,开发人员告诉他 ... -
ORACLE随机取数据
2011-10-25 23:53 926目前负责的这个数字化项目,需要开发个质检工具,实现每次随机取2 ... -
oracle将一行拆分为多行
2011-10-12 00:51 2155客户的业务涉及大量的图片信息,之前这些图片信息只在数据库里存着 ... -
ORA-01034、ORA-27101和ORA-28056错误解决方法
2011-10-11 00:40 2247今天登录数据库的时候遇到了ORA-01034和ORA-2710 ... -
查看某个用户下的所有空表
2011-10-09 15:01 1058今天在群里有人问如何 ... -
SQL*LOADER加载图片、TXT
2011-10-09 15:02 1093朋友打电话问我如何利 ... -
oracle10gR2新特性--透明加密(TDE)
2011-10-09 15:02 1959从10gR2开始,oracle推出了透明数据加密技术(Tran ... -
NAMES.DIRECTORY_PATH客户端连接参数
2011-10-08 22:38 3863今天在做oracle10gR2新特性透明加密(TDE)的时候, ... -
tnsping通却连接不上数据库
2011-10-08 22:26 2439今天在Windows XP上装可个11gR2数据库,却出现个很 ... -
ORACLE字符集检查工具CSSCAN
2011-10-08 22:22 1801我们在创建数据库的时候,通常会把字符集设置为ZHS16GBK, ... -
SQL*LOADER和外部表加载
2011-10-08 22:17 1337最近一直在用SQL*LOADER加载数据,用外部表也可以实现, ... -
创建本地Duplicate数据库
2011-10-08 22:14 1034Duplicate是RMAN的一个组成部分,利用Duplica ... -
由ACOUG、云和恩墨主办的”Oracle技术嘉年华(OTN China Tour 2011)“活动已经正式拉开帷幕。
2011-09-01 12:00 790由ACOUG、云和恩墨主办的”Oracle技术嘉年华(OTN ... -
enq: TX - row lock contention
2011-07-19 17:52 1132今天,收到客户的邮件说上周每天早上10点多,数据库都会有很多锁 ...
相关推荐
数据库 等待事件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...
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 ...
buffer busy waits db file parallel write db file single write db file scattered read db file sequential read diret path write/read enqueue
队列等待之TX - allocate ITL entry引起的死锁处理 ...Db file sequential read异常等待事件分析与处理。 Db file scattered read异常等待事件分析与处理。 Direct path read异常等待事件分析与处理。
看书笔记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来查看系统当前的等待事件,以及与等待事件相...
9.5.2 db file scattered read等待事件 440 9.5.3 direct path read/write(直接路径读/写) 444 9.5.4 日志文件相关等待 453 9.5.5 Enqueue(队列等待) 458 9.5.6 Latch Free(闩锁释放) 462 9.5.7 Oracle ...
Scattered Data Interpolation in Three or More VariablesScattered Data Interpolation in Three or More Variables
MATLAB 三维点云重构Surface recostruction from scattered points cloud MyCrust090209(matlab).zip
开源项目-abourget-getting-started-with-golang.zip,Installing Go tools for Sublime is scattered all around.. help me have a definitive guide.
Python分散文件
For tissue imaging,the least-scattered photons arriving at a detector may have a significant effect on the development of imaging algorithms. Tracing least-scattered photons may be helpful for ...
Static Hand Gesture Recognition with Electromagnetic Scattered Field via Complex Attention Convolutional Neural Network
The scattered intensity profiles are extracted by converting the patterns in real space into the wave vector space. Isotropic and anisotropic samples of the rough backsides of silicon wafer are ...
径向基函数 (RBF) 可用于散点数据的插值和近似,即数据不需要位于任何规则网格上。 同一个函数可以处理任何维度的数据插值。 有关更多示例,请参阅文件 rbftest.m。 1. 创建 RBF 插值使用rbf=rbfcreate(x, f);...
对QAM的频谱、散图、眼图以及误码率进行了仿真。使用matlab语言。
散射系数的计算,以及散射光强分布场的计算。一整套程序
用Shepard方法实现散乱数据的曲面拟合
No tangled implicit constructions polluting your namespace and functionality scattered across multiple components. No manual management of connections. Concurrency. A single SORM instance can safely ...
Hundreds of scattered vignettes, web pages, and forums explain how to use R in particular domains. But little has been written on how to simply make R work effectively—until now. This hands-on book ...
Scattered pilot detection of CMMB signals based on data smoothing in cognitive radio networks