ABAP 優化文件【來自網路】加個人體會 - 1
SAP ABAP Performance Tuning
Tips & Tricks
Performance Analysis Tools
Use of selection criteria:查詢資料加入限定條件,不要取不必要的東西-->能少則少
Instead of selecting all the data and doing the processing during the selection, it is advisable to restrict the data to the selection criteria itself, rather than filtering it out using the ABAP code.
Not recommended
Select * from zflight.
Check : zflight-airln = ‘LF’ and zflight-fligh = ‘BW222’.
Endselect.
Recommended
Select * from zflight where airln = ‘LF’ and fligh = ‘222’.
Endselect.
One more point to be noted here is of the select *. Often this is a lazy coding practice. When a programmer gives select * even if one or two fields are to be selected, this can significantly slow the program and put unnecessary load on the entire system. When the application server sends this request to the database server, and the database server has to pass on the entire structure for each row back to the application server. This consumes both CPU and networking resources, especially for large structures.
Thus it is advisable to select only those fields that are needed, so that the database server passes only a small amount of data back.
Also it is advisable to avoid selecting the data fields into local variables as this also puts unnecessary load on the server. Instead attempt must be made to select the fields into an internal table.
個人體會:如果你在抓取資料後,還有範圍的選擇,那麼大可將此範圍的限定,加入到SQL語句中,這樣可以降低資料量在網路中的流通,更快地傳輸吧
Use of aggregate functions:取一批資料過來,如果本身有一些集合動作可以放到資料庫中做:要用集運算,則用集運算
Use the already provided aggregate functions, instead of finding out the minimum/maximum values using ABAP code.
Not recommended
Maxnu = 0.
Select * from zflight where airln = ‘LF’ and cntry = ‘IN’.
Check zflight-fligh > maxnu.
Maxnu = zflight-fligh.
Endselect.
Recommended
Select max( fligh ) from zflight into maxnu where airln = ‘LF’ and cntry = ‘IN’.
The other aggregate functions that can be used are min (to find the minimum value), avg (to find the average of a Data interval), sum (to add up a data interval) and count (counting the lines in a data selection).
個人體會:比如要做匯總,其實在資料庫做更快,而資料量也大大的降低,所以這個方法是最好用也是最容易用的
Use of Views instead of base tables:如果有幾個表關聯,那麼就乾脆建各View吧
Many times ABAP programmers deal with base tables and nested selects. Instead it is always advisable to see whether there is any view provided by SAP on those base tables, so that the data can be filtered out directly, rather than specially coding for it.
Not recommended
Select * from zcntry where cntry like ‘IN%’.
Select single * from zflight where cntry = zcntry-cntry and airln = ‘LF’.
Endselect.
Recommended
Select * from zcnfl where cntry like ‘IN%’ and airln = ‘LF’.
Endselect.
個人體會:這樣用起來方便
Use of the into table clause of select statement:將資料一次取到表中,減少資料庫訪問次數
Instead of appending one record at a time into an internal table, it is advisable to select all the records in a single shot.
Not recommended
Refresh: int_fligh.
Select * from zflight into int_fligh.
Append int_fligh. Clear int_fligh.
Endselect.
Recommended
Refresh: int_fligh.
Select * from zflight into table int_fligh.
個人體會:應該說資料庫的訪問效率還是比較低的,所以減少對話,把資料抓到程式中做運算準備
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/554557/viewspace-470534/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- ABAP 優化文件【來自網路】加個人體會 - 3優化
- ABAP 優化文件【來自網路】加個人體會 - 2優化
- Oracle 優化詳解——來自網路Oracle優化
- SQL優化說明文件(1)SQL優化
- web下的效能優化1(網路方向)Web優化
- 通過自動化和現代化實現網路優化優化
- iOS 網路優化iOS優化
- 網路優化設定的具體步驟優化
- Python 3.8 新功能-來自社群翻譯貼-個人改進程式碼優化版Python優化
- SAP ABAP 效能優化實踐優化
- 網路管理自動化
- 致謝參加虛擬化技術網路大會的朋友們薦
- 運籌優化(八)--圖與網路優化優化
- 九、Android效能優化之網路優化Android優化
- Android 效能優化(八)之網路優化Android優化
- ABAP文件生成工具
- 深度優化 iOS 網路模組優化iOS
- 網路效能優化常用方法優化
- iOS效能優化 - 網路圖片載入優化iOS優化
- 谷歌重返中國,會給中國網際網路帶來怎樣的變化谷歌
- 2014第八屆移動網際網路國際研討會請你來參加
- 網際網路有機會“慢”下來麼?
- 漫漫優化路,總會錯幾步(記一次介面優化)優化
- 如何優化深度神經網路?優化神經網路
- 網路效能優化及安全保障優化
- 個人部落格 SEO 優化(1):搜尋引擎原理介紹優化
- 5個小眾化的自媒體網站,速速收藏起來網站
- 個人部落格 SEO 優化(2):站內優化優化
- 自智網路:網路自身的數字化轉型
- 百度App網路深度優化系列《一》DNS優化APP優化DNS
- 網路安全法獲高票通過 明確加強個人資訊保護
- 網路安全法獲高票透過 明確加強個人資訊保護
- 利用進化方法自動生成神經網路:深度進化網路DENSER神經網路
- Hexo 個人部落格 SEO 優化(1):搜尋引擎原理介紹Hexo優化
- Unity記憶體最佳化(來自uwa)Unity記憶體
- “網際網路+廣交會”,AMT助廣交會確立網際網路時代競爭新優勢
- TensorFlow神經網路優化策略神經網路優化
- 網路優化需要學習什麼優化