欢迎来到天天文库
浏览记录
ID:40710163
大小:30.50 KB
页数:4页
时间:2019-08-06
《abap 程序优化点滴》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、abap程序优化点滴1、使用where语句不推荐Select*fromzflight.Check:zflight-airln=‘LF’andzflight-fligh=‘BW222’.Endselect.推荐Select*fromzflightwhereairln=‘LF’andfligh=‘222’.Endselect.2、使用聚合函数不推荐Maxnu=0.Select*fromzflightwhereairln=‘LF’andcntry=‘IN’.Checkzflight-fligh>maxnu.Maxnu=zflight-fligh.Endselect.推荐Selec
2、tmax(fligh)fromzflightintomaxnuwhereairln=‘LF’andcntry=‘IN’.3、使用视图代替基本表查询不推荐Select*fromzcntrywherecntrylike‘IN%’.Selectsingle*fromzflightwherecntry=zcntry-cntryandairln=‘LF’.Endselect.推荐Select*fromzcnflwherecntrylike‘IN%’andairln=‘LF’.Endselect.4、使用INTOtable代替selectendselect不推荐Refresh:int_
3、fligh.Select*fromzflightintoint_fligh.Appendint_fligh.Clearint_fligh.Endselect.推荐Refresh:int_fligh.Select*fromzflightintotableint_fligh.5、使用批量修改内表代替逐行修改不推荐Loopatint_fligh.Ifint_fligh-flagisinitial.Int_fligh-flag=‘X’.Endif.Modifyint_fligh.Endloop.推荐Int_fligh-flag=‘X’.Modifyint_flightranspor
4、tingflagwhereflagisinitial.6、使用二分法查询,提高查询内表数据速度不推荐Readtableint_flighwithkeyairln=‘LF’.推荐Readtableint_flighwithkeyairln=‘LF’binarysearch.7、两个内表添加使用批量增加代替逐行不推荐Loopatint_fligh1.Appendint_fligh1toint_fligh2.Endloop.推荐Appendlinesofint_fligh1toint_fligh2.8、使用tablebufferingUseofbufferedtablesisre
5、commendedtoimprovetheperformanceconsiderably.ThebufferisbypassedwhileusingthefollowingstatementsSelectdistinctSelect…forupdateOrderby,groupby,havingclauseJoinsUsetheBypassbufferadditiontotheselectclauseinordertoexplicitlybypassthebufferwhileselectingthedata.9、使用FORALLEntries不推荐Loopatint_cn
6、try.Selectsingle*fromzflighintoint_flighwherecntry=int_cntry-cntry.Appendint_fligh.Endloop.推荐Select*fromzflighappendingtableint_flighForallentriesinint_cntryWherecntry=int_cntry-cntry.10、正确地使用where语句,使查询能使用索引Whenabasetablehasmultipleindices,thewhereclauseshouldbeintheorderoftheindex,either
7、aprimaryorasecondaryindexTochooseanindex,theoptimizerchecksthefieldnamesspecifiedinthewhereclauseandthenusesanindexthathasthesameorderofthefields.OnemoretipisthatifatablebeginswithMANDT,whileanindexdoesnot,thereisahighpossibilitythattheoptimizermightnotusethat
此文档下载收益归作者所有