Download Android App of sapabap-vamsi

sapabap-vamsi : Download Android App for Mobiles

Friday, August 26, 2011

SAP ABAP Performance Tuning - 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.

No comments:

Post a Comment