欢迎来到Doc100.Net免费学习资源知识分享平台!
您的位置:首页 > 程序异常 >

sybase调优-在sql中拇指定索引

更新时间: 2014-05-14 18:43:37 责任编辑: Author_N3

 

SYBASE调优-在SQL中指定索引
sybase有时候真的是让人奔溃,以下是一条速度很慢的SQL:
SELECT 
  EII.BARCODE,  
  ....
  FROM 
  ETS_ITEM_MATCH      EIM,
  ETS_FA_ASSETS       EFA ,  
  ETS_ITEM_INFO       EII ,
  AMS_OBJECT_ADDRESS  AOA,
  ETS_OBJECT          EO,
  AMS_MIS_EMPLOYEE    AME,
  ETS_SYSTEM_ITEM     ESI 
  WHERE 
  EIM.SYSTEMID = EII.SYSTEMID 
  AND EII.ITEM_CODE = ESI.ITEM_CODE 
  AND EIM.ASSET_ID = EFA.ASSET_ID 
  AND EII.ADDRESS_ID = AOA.ADDRESS_ID 
  AND AOA.OBJECT_NO = EO.WORKORDER_OBJECT_NO  
  AND EII.RESPONSIBILITY_USER *= AME.EMPLOYEE_ID   
  ORDER BY 
  EO.WORKORDER_OBJECT_CODE DESC






对表指定了索引后,速度有所改进 .

SELECT 
  EII.BARCODE,  
  ....
  FROM 
  ETS_ITEM_MATCH      EIM (INDEX ETS_ITEM_MATCH_110708_U1),  
  ETS_FA_ASSETS       EFA (INDEX ETS_FA_ASSETS_PK),  
  ETS_ITEM_INFO       EII (INDEX ETS_ITEM_INFO_110708_N7),  
  AMS_OBJECT_ADDRESS  AOA (INDEX AMS_OBJECT_ADDRESS_N), 
  ETS_OBJECT          EO (INDEX ETS_OBJECT_11089119911), 
  AMS_MIS_EMPLOYEE    AME (INDEX AMS_MIS_EM_6748144351), 
  ETS_SYSTEM_ITEM     ESI (INDEX ETS_SYSTEM_ITEM_PK) 
  WHERE 
  EIM.SYSTEMID = EII.SYSTEMID 
  AND EII.ITEM_CODE = ESI.ITEM_CODE 
  AND EIM.ASSET_ID = EFA.ASSET_ID 
  AND EII.ADDRESS_ID = AOA.ADDRESS_ID 
  AND AOA.OBJECT_NO = EO.WORKORDER_OBJECT_NO 
  ....


当然还可以指定这些SQL的执行计划,后面将会讨论Sybase的执行计划。

上一篇:上一篇
下一篇:下一篇

 

随机推荐程序问答结果

 

 

如对文章有任何疑问请提交到问题反馈,或者您对内容不满意,请您反馈给我们DOC100.NET论坛发贴求解。
DOC100.NET资源网,机器学习分类整理更新日期::2014-05-14 18:43:37
如需转载,请注明文章出处和来源网址:http://www.doc100.net/bugs/t/289158/
本文WWW.DOC100.NET DOC100.NET版权所有。