收藏 分享(赏)

性能调整1.doc

上传人:hskm5268 文档编号:7163784 上传时间:2019-05-07 格式:DOC 页数:5 大小:210.50KB
下载 相关 举报
性能调整1.doc_第1页
第1页 / 共5页
性能调整1.doc_第2页
第2页 / 共5页
性能调整1.doc_第3页
第3页 / 共5页
性能调整1.doc_第4页
第4页 / 共5页
性能调整1.doc_第5页
第5页 / 共5页
亲,该文档总共5页,全部预览完了,如果喜欢就下载吧!
资源描述

1、今天早上(11 月 12 号),发现计划系统 ORACLE 很繁忙,通过 QLISE 工具找到了消耗系统CPU 资源最厉害的 ORACLE 线程号(8ec),再通过系统的数据字典(V$SESSION,V$SQL,V$PROCESS),找出了正在系统中运行的 SQL 语句.SELECT inid, sender, imei, materialcode, lot, phonemodelcode, colorcode, jobid,dealflag, remarkFROM tcs.vw_phoneiosubdown_for_ml_v25WHERE checkdate = TO_DATE (TO_CH

2、AR (:v1, yyyy/mm/dd), yyyy/mm/dd)- 1AND nodeid = :v2其中视图 tcs.vw_phoneiosubdown_for_ml_v25 的内容为:select T_Exchange.Id as InId,T_Exchange.CompanyCode as NodeId,T_ExchangeOutImei.IMEI as IMEI,T_ExchangeOutImei.MATERIALCODE as MaterialCode,T_ExchangeOutImei.Lot as LOT,T_ExchangeOutImei.ModelCode as Phone

3、ModelCode,T_ExchangeOutImei.Color as ColorCode,T_Exchange.Checkdate as CheckDate, as JobId,0 as Sender,null as DealFlag, as Remarkfrom T_Exchange,T_ExchangeOutImei where T_ExchangeOutImei.TableId=T_Exchange.Id and T_Exchange.ReceiveFlag=Y and T_Exchange.billTypeCode like ZZJ% union- select T_Exchang

4、e.Id as InId,T_Exchange.CompanyCode as NodeId,T_ExchangeOutImei.IMEI as IMEI,T_ExchangeOutImei.MATERIALCODE as MaterialCode,T_ExchangeOutImei.Lot as LOT,T_ExchangeOutImei.ModelCode as PhoneModelCode,T_ExchangeOutImei.Color as ColorCode,T_Exchange.Checkdate as CheckDate, as JobId,0 as Sender,null as

5、DealFlag, as Remarkfrom T_Exchange,T_ExchangeOutImei where T_ExchangeOutImei.TableId=T_Exchange.Id and T_Exchange.ReceiveFlag=Y and T_Exchange.billTypeCode like ZZMK% union -(StockIOType=N)select JobId2Number(T_PhoneIOSub.IONo) as InId,T_PhoneIOMain.Receiver as NodeId,T_PhoneIOSub.IMEI as IMEI,T_Pho

6、neIOSub.MaterialCode as MaterialCode,T_PhoneIOSub.LOT as LOT,T_PhoneIOSub.PhoneModelCode as PhoneModelCode,T_PhoneIOSub.ColorCode as ColorCode,T_PhoneIOMain.LastModified as CheckDate,T_PhoneAccept.Originaljobid as JobId,T_PhoneIOMain.NodeId as Sender,T_PhoneIOSub.Dealflag as DealFlag, as Remarkfrom

7、T_PhoneIOSub,T_PhoneIOMain,T_PhoneAcceptwhere T_PhoneIOSub.IONo=T_PhoneIOMain.IONo and T_PhoneIOSub.Jobid=T_PhoneAccept.JobId(+) andDeposeFlag=N and StockIOType=N and T_PhoneIOMain.NodeIDT_PhoneIOMain.ReceiverUNION-select JobId2Number(T_PhoneIOSub.IONo) as InId,T_PhoneIOMain.Receiver as NodeId,T_Pho

8、neIOSub.IMEI as IMEI,T_PhoneIOSub.MaterialCode as MaterialCode,T_PhoneIOSub.LOT as LOT,T_PhoneIOSub.PhoneModelCode as PhoneModelCode,T_PhoneIOSub.ColorCode as ColorCode,T_PhoneIOMain.LastModified as CheckDate, as JobId,T_PhoneIOMain.NodeId as Sender,T_PhoneIOSub.Dealflag as DealFlag,T_PhoneIOSub.Rem

9、arkfrom T_PhoneIOSub,T_PhoneIOMain,T_DamageAfterArrivewhere T_PhoneIOSub.IONo = T_PhoneIOMain.IONo and T_PhoneIOMain.DeposeFlag=N and T_PhoneIOMain.StockIOType=O and (T_PhoneIOMain.StockType=B) and T_PhoneIOMain.NodeID =TO_DATE (TO_CHAR (:v1, yyyy/mm/dd), yyyy/mm/dd) 1”于是为 checkdate 创建索引:create inde

10、x tcs.T_PhoneIOMain_checkdate on tcs.T_PhoneIOMain(lastmodified) tablespace tcs重新分析其执行计划,如下图此时 tcs.T_PhoneIOMain 已经走索引检索,COST=403,提高近 10 倍.再次分析执行计划, logis.t_exchange 仍然走全表扫描,且有近 7 万条数据,再次为此表的 CHECKDATE 创建索引:create index LOGIS.INDEX_CHECKDATE on LOGIS.T_EXCHANGE (CHECKDATE)tablespace LOGIS再次分析执行计划如下, logis.t_exchange 已经走索引检索 ,COST=103,再次提高近4 倍 .至此,执行成本从 3993 降到 103,提高近 40 倍.系统 CPU 使用率急剧下跌.

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 企业管理 > 管理学资料

本站链接:文库   一言   我酷   合作


客服QQ:2549714901微博号:道客多多官方知乎号:道客多多

经营许可证编号: 粤ICP备2021046453号世界地图

道客多多©版权所有2020-2025营业执照举报