oracle 搜索时间过长麻烦别人帮忙怎么说帮忙优化下 谢谢了

新手上路, 积分 0, 距离下一级还需 50 积分
最后登录在线时间45 小时威望0 金钱339 注册时间阅读权限10帖子精华0积分0UID751
查看: 1454|
本帖最后由 suredandan 于
11:23 编辑
数据库版本11.2.0.3&&RAC,操作系统为redhat5.8 64位。
最近系统一到高峰期就很慢,请别人做了一个3个小时间隔的awr报告,因为时间间隔太长,所以无法精确定位高峰期的信息,只能根据等待事件来判断一下:
00:20 上传
发现主要的等待事件为db file scattered read,然后去查了一下sql order那一截,发现主要的sql均为和物化视图刷新的sql。这个系统物化视图用的比较多,都是以快速刷新方式创建的。
00:24 上传
另外,根据db file scattered read等待事件,我也请别人查了一下:大量物理读sql、全表扫描的sql、全索引扫描的sql,发现依然是和物化视图刷新有关的。
00:27 上传
再查了下io读取的性能,多块读基本都在10微秒左右,IO上面应该是没问题的。
00:28 上传
另外,因为是RAC的,所以还看了一下awr的RAC一个性能指标
00:32 上传
从这个上面看到disk读很高,我想这个也是慢的原因。
现在想请教一下,我接下来应该怎么对这个系统或者说对这些物化视图去做优化呢?因为我觉得物化视图都已经是快速刷新了,而且差不多是每半个月都要手工对这些物化视图的物化视图日志进行move来降低高水位,甚至对一些物化视图进行重建。请教一下思路,谢谢。
00:33 上传
点击文件名下载附件
951.57 KB, 下载次数: 65
最后登录在线时间1669 小时威望2135 金钱49175 注册时间阅读权限200帖子精华39积分2135UID2
给出该语句:
/* MV_REFRESH (DEL) */ DELETE FROM &ISC&.&GETUSERSBYORGROLE_MVIEW& SNA$ WHERE &AROWID& IN (SELECT /*+ NO_MERGE HASH_SJ */ * FROM (SELECT CHARTOROWID(&MAS$&.&M_ROW$$&) RID$ FROM &ISC&.&MLOG$_ISC_USER& &MAS$& WHERE &MAS$&.SNAPTIME$$ & :B_ST1 ) AS OF SNAPSHOT(:B_SCN) MAS$)
6ph89trc2y0um
的 @?/rdbms/admin/awrsqrpt 信息
新手上路, 积分 0, 距离下一级还需 50 积分
最后登录在线时间45 小时威望0 金钱339 注册时间阅读权限10帖子精华0积分0UID751
本帖最后由 suredandan 于
23:41 编辑
Maclean Liu(刘相兵 发表于
给出该语句:
/* MV_REFRESH (DEL) */ DELETE FROM &ISC&.&GETUSERSBYORGROLE_MVIEW& SNA$ WHERE &AROWID& ...
这个只有明天才能给出来,因为甲方的人都下班了。。
刘大,你是想通过看执行计划来确定是不是“_mv_refresh_use_stats”的问题吗?
新手上路, 积分 0, 距离下一级还需 50 积分
最后登录在线时间45 小时威望0 金钱339 注册时间阅读权限10帖子精华0积分0UID751
6ph89trc2y0um的awrsqrpt 信息来了
22:40 上传
点击文件名下载附件
17.89 KB, 下载次数: 76
新手上路, 积分 0, 距离下一级还需 50 积分
最后登录在线时间45 小时威望0 金钱339 注册时间阅读权限10帖子精华0积分0UID751
Maclean Liu(刘相兵 发表于
给出该语句:
/* MV_REFRESH (DEL) */ DELETE FROM &ISC&.&GETUSERSBYORGROLE_MVIEW& SNA$ WHERE &AROWID& ...
刘大,已经贴了sql的awr了,请帮忙看看,3Q。
最后登录在线时间1669 小时威望2135 金钱49175 注册时间阅读权限200帖子精华39积分2135UID2
Id& & & & Operation& & & & Name& & & & Rows& & & & Bytes& & & & Cost (%CPU)& & & & Time
0& & & & DELETE STATEMENT& & & &&&& & & &&&& & & &&&& & & & 377 (100)& & & &&&
1& & & && & DELETE& & & & GETUSERSBYORGROLE_MVIEW& & & &&&& & & &&&& & & &&&& & & &&&
2& & & && && &HASH JOIN RIGHT SEMI& & & &&&& & & & 203& & & & 36743& & & & 377 (1)& & & & 00:00:05
3& & & && && &&&TABLE ACCESS FULL& & & & MLOG$_ISC_USER& & & & 12& & & & 1656& & & & 371 (0)& & & & 00:00:05
4& & & && && &&&MAT_VIEW ACCESS FULL& & & & GETUSERSBYORGROLE_MVIEW& & & & 203& & & & 8729& & & & 5 (0)& & & & 00:00:01
select count(*) from MLOG$_ISC_USER;
select count(*) from GETUSERSBYORGROLE_MVIEW;
新手上路, 积分 0, 距离下一级还需 50 积分
最后登录在线时间45 小时威望0 金钱339 注册时间阅读权限10帖子精华0积分0UID751
select count(*) from MLOG$_ISC_USER;
select count(*) from GETUSERSBYORGROLE_MVIEW;
感觉走HASH_SJ 不如走 NESTED LOOPS
新手上路, 积分 0, 距离下一级还需 50 积分
最后登录在线时间45 小时威望0 金钱339 注册时间阅读权限10帖子精华0积分0UID751
Maclean Liu(刘相兵 发表于
Id& & & & Operation& & & & Name& & & & Rows& & & & Bytes& & & & Cost (%CPU)& & & & Time
0& & & & DELETE STATEMENT& & & &&&& & & &&&& & & &&&& & & & 377 (100)& & & &&&
1& & & && & DELETE& & & & GETUS ...
select count(*) from MLOG$_ISC_USER;
select count(*) from GETUSERSBYORGROLE_MVIEW;
感觉走HASH_SJ 不如走 NESTED LOOPS
最后登录在线时间342 小时威望29 金钱6349 注册时间阅读权限200帖子精华5积分29UID1
select count(*) from GETUSERSBYORGROLE_MVIEW;
上述执行计划 中对该表全表扫描的成本评估显然不足,可以考虑通过 统计信息来 “优化”该SQL
新手上路, 积分 0, 距离下一级还需 50 积分
最后登录在线时间45 小时威望0 金钱339 注册时间阅读权限10帖子精华0积分0UID751
Liu Maclean(刘相兵 发表于
select count(*) from GETUSERSBYORGROLE_MVIEW;
谢谢~ 我先去检查一下统计信息的收集情况,以及这个mv的dml的频率。
新手上路, 积分 0, 距离下一级还需 50 积分
最后登录在线时间15 小时威望0 金钱97 注册时间阅读权限10帖子精华0积分0UID1807
比较典型的一个问题,好贴备注一下
扫码关注dbDao 微信公众号:
Powered by
TEL/電話+86大家帮忙看下这个sql语句吧,给优化一下。执行好长时间也执行不出来。oracle的_百度知道
大家帮忙看下这个sql语句吧,给优化一下。执行好长时间也执行不出来。oracle的
rrpp.v_qm_r_rolling_pass_par 看看能优化下不.Z13
rrpp_Z13.qm_result
v_query_qm_result.D13
rrpp_D4.hf_id
v_query_hf_id,
v_query.Y1
rrpp_Y1.D11
v_query.Y11
rrpp_Y11.D2
rrpp_D2.qm_reason
v_query_qm_reason.coil_id
v_query_coil_id,
v_query.Y12
rrpp_Y12.D10
rrpp_D10.Z10
rrpp_D1.Y7
rrpp_Y7.Z7
rrpp,oqs.Z6
rrpp_Z6.Y13
rrpp_Y13.Z3
rrpp_Z3.Z11
v_query.v_qm_r_rolling_pass_par rrpp
rrpp.coil_id(+) = v_query,
rrpp_Z2.Y9
rrpp_Y9.D12
rrpp_D12.Z5
rrpp_Z5.D8
v_query.Y6
v_query.D3
rrpp_D7.Z8
rrpp,有一个视图数据量比较大,
rrpp.COILER_ID
v_query_COILER_ID,
rrpp_Z4,大家给看一下吧,
rrpp.coil_id
就是这个语句.Z1
rrpp_Z1 FROM oqs,
rrpp_Y8.v_qm_coil_query v_query.Y5
rrpp_Y5.D5
v_query.Y2
rrppselect
v_query.coil_mattime
v_query_coil_mattime.D6
rrpp_D6.HEAT_ID
v_query_HEAT_ID.STEEL_GRADE
v_query_STEEL_GRADE
提问者采纳
rrpp_D11.Y13
rrpp_D6.Y7
rrpp_Y6.Z7
rrpp_Z7.HEAT_ID
v_query_HEAT_ID.qm_reason
v_query_qm_reason.Y10
rrpp_Y10.Y2
rrpp_Y3.Y8
rrpp_Y8.Z10
rrpp_Z10、使用Left Join链接查询select
v_query.hf_id
v_query_hf_id,
rrpp.v_qm_r_rolling_pass_par rrpp
rrpp_Z5.v_qm_coil_query (coil_id)
Create Index idx_rrpp_coil_id on oqs.D8
rrpp、在两个表上建立非聚簇索引
Create Index idx_query_coil_id on
rrpp.v_qm_coil_query v_query LEFT JOIN oqs,
rrpp_D2.STEEL_GRADE
v_query_STEEL_GRADE,
rrpp_Z11.Z13
v_query.Y4
rrpp_Y4.D1
rrpp_D1.coil_id= v_query.Y11
rrpp.v_qm_r_rolling_pass_par (coil_id)2,
rrpp.coil_id
v_query_coil_id.D13
v_query.qm_result
v_query_qm_result.Z6
rrpp_Z6.Z12
v_query.coil_mattime
v_query_coil_mattime.COILER_ID
v_query_COILER_ID.D5
rrpp_D7.Z8
rrpp_Z8.Y12
rrpp_Y12.Y5
rrpp_Y5.Y9
rrpp_Y9.D12
rrpp_D12.Z1
rrpp_Z1 FROM oqs,
提问者评价
其他类似问题
为您推荐:
sql语句的相关知识
其他2条回答
如果是在索引上,这两张表的COIL_ID字段是否在索引上,也就是说,有没有走在索引上这个语句,那么在SQL上的优化可能不太好做了
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁输入您需解决的
软件开发问题并开始搜索,
IT异常查询网可以方便地提供各类
程序错误解决方案。
SQL语句优化,帮忙看看,多谢 - Oracle技术
&&&发布于: 21:54:54&&&
SQL语句优化,帮忙看看,谢谢语句本身没有问题,关键是能否进行优化?找个高手帮忙看看.这条命令是出学生成绩的,当中用到了大量的regexp_substr,这是从题块里面拆得分点,比如语文,如果有八个题块,就要拆八次,而每个题块又各自有不同的得分点,因此拆完之后可能要进行八次以上的合并,因为学生的考号是在另一张表里,进行拆分的表里面只有试卷的试卷号!合并完之后,又还有一次合并,就是将得分点与客观题合并,所以这命令里面有X,Y表的命名.总体上,有三次大的合并!得分点本身的合并,是根据得分点的个数随机进行的,最多的一般是数学,可能有20多个得分点,就要并20多次,我个人感觉很有问题,效率低下...人数不多的时候,没什么问题,但一旦超过一万人......我曾经弄好了一个程序,结果发现,在大考的情况下,一万多人的时候,这条命令有时候很慢!!!要三十秒,我受不了这个速度,能不能再快一点???谢谢帮忙!select x.code,x.name,x.schoolid,x.grade,x.km,x.classroomid,x.OMR1,x.OMR2,x.OMR3,x.OMR4,x.OMR5,x.OMR6,y.point1,y.point2,y.point3,y.point4,y.point5,y.point6,y.point7,y.point8,y.point9,y.point10,y.point11,y.point12,y.point13,y.point14,y.point15,y.point16,y.point17,y.point18,y.point19,y.point20,y.point21,y.point22,y.point23,x.subjectscore as SCORE from(select a.code,a.name,a.schoolid,a.grade,a.km,a.classroomid,a.OMR1,a.OMR2,a.OMR3,a.OMR4,a.OMR5,a.OMR6,b.subjectscore from(select * from newschool.cd_alldetail where examname=114 and km='初一语文') a,(select * from cd_subjectscore_rank where examid=114 and subjectname='初一语文') b where a.code=b.code and a.km=b.subjectname order by code)x,(select d.code,d.name,d.distid,d.schoolid,d.grade,d.classroomid,d.subjectid,E.point1,E.point2,E.point3,E.point4,E.point5,E.point6,E.point7,E.point8,E.point9,E.point10,E.point11,E.point12,E.point13,E.point14,E.point15,E.point16,E.point17,E.point18,E.point19,E.point20,E.point21,E.point22,E.point23 from& (select a.code,a.name,a.distid,a.schoolid,a.grade,a.classroomid,b.subjectid,b.paperid from& (select code,name,distid,schoolid,grade,classroomid from exam114.cd_student where subjectid=21) a,(select code,subjectid,paperid from exam114.cd_scanlist where subjectid=21) b where a.code=b.code) d,(select a1.paperid,a1.point1,a1.point2,a2.point3,a2.point4,a2.point5,a2.point6,a3.point7,a4.point8,a4.point9,a5.point10,a5.point11,a5.point12,a5.point13,a5.point14,a6.point15,a6.point16,a6.point17,a6.point18,a6.point19,a6.point20,a7.point21,a7.point22,a7.point23 from& (select subjectid,paperid,to_number(regexp_substr(subscore,'[^,]+',1,1)) point1,to_number(regexp_substr(subscore,'[^,]+',1,2)) point2 from exam114.cd_final where subjectid=21 and itemid=1) a1,(select subjectid,paperid,to_number(regexp_substr(subscore,'[^,]+',1,1)) point3,to_number(regexp_substr(subscore,'[^,]+',1,2)) point4,to_number(regexp_substr(subscore,'[^,]+',1,3)) point5,to_number(regexp_substr(subscore,'[^,]+',1,4)) point6 from exam114.cd_final where subjectid=21 and itemid=2) a2,(select subjectid,paperid,to_number(regexp_substr(subscore,'[^,]+',1,1)) point7 from exam114.cd_final where subjectid=21 and itemid=3) a3,(select subjectid,paperid,to_number(regexp_substr(subscore,'[^,]+',1,1)) point8,to_number(regexp_substr(subscore,'[^,]+',1,2)) point9 from exam114.cd_final where subjectid=21 and itemid=4) a4,(select subjectid,paperid,to_number(regexp_substr(subscore,'[^,]+',1,1)) point10,to_number(regexp_substr(subscore,'[^,]+',1,2)) point11,to_number(regexp_substr(subscore,'[^,]+',1,3)) point12,to_number(regexp_substr(subscore,'[^,]+',1,4)) point13,to_number(regexp_substr(subscore,'[^,]+',1,5)) point14 from exam114.cd_final where subjectid=21 and itemid=5) a5,(select subjectid,paperid,to_number(regexp_substr(subscore,'[^,]+',1,1)) point15,to_number(regexp_substr(subscore,'[^,]+',1,2)) point16,to_number(regexp_substr(subscore,'[^,]+',1,3)) point17,to_number(regexp_substr(subscore,'[^,]+',1,4)) point18,to_number(regexp_substr(subscore,'[^,]+',1,5)) point19,to_number(regexp_substr(subscore,'[^,]+',1,6)) point20 from exam114.cd_final where subjectid=21 and itemid=6) a6,(select subjectid,paperid,to_number(regexp_substr(subscore,'[^,]+',1,1)) point21,to_number(regexp_substr(subscore,'[^,]+',1,2)) point22,to_number(regexp_substr(subscore,'[^,]+',1,3)) point23 from exam114.cd_final where subjectid=21 and itemid=7) a7 where a1.paperid=a2.paperid and a1.paperid=a3.paperid and a1.paperid=a4.paperid and a1.paperid=a5.paperid and a1.paperid=a6.paperid and a1.paperid=a7.paperid order by a1.paperid) E where d.paperid=e.paperid and d.subjectid=21 order by d.code) y where x.code=y.code and x.name=y.name order by x.code
相关解决方法
你也许会喜欢
Web前端&&热门解决方法
Web前端&&最新解决方法
Web前端&&随机解决方法
诚心交换友情链接:qq:

我要回帖

更多关于 麻烦你了 谢谢 的文章

 

随机推荐