What tools can be used to help with performance tuning?
- ST05 : this is used to trace performance of the program. it trace SQL performance and mainly used to trace the performance of the select statements used in the program.
- SAT : used to measure the application performance. it analyse the runtime performance of the program.
- ST12 : this is combination of ST05 and SAT transactions.
- EPC (Tcode SLIN) and CI (Tcode SCI ) tools.
What are the steps to optimize the ABAP Code?
- DATABASE
- Use WHERE clause in your SELECT statement to restrict the volume of data retrieved. Very important !!
- Design your Query to Use as much index fields as possible in your WHERE statement
- Use INNER (or OUTER under some circumstances) JOIN in your SELECT statement to retrieve the matching records at one shot
- Avoid using nested SELECT statement and SELECT within LOOPs, better use JOINs or FOR ALL ENTRIES. Use FOR ALL ENTRIES when the internal table is already there or the end of some processing. Try JOINs if the SELECT are right behind each other
- Avoid using INTO CORRESPONDING FIELDS OF TABLE during buffered access. Otherwise use the most appropriate for the program.
- Avoid using SELECT * and Select only the required fields from the table.
- Avoid using ORDER BY in SELECT statements if it differs from used index (instead, sort the resulting internal table), because this may add additional work to the database system which is unique, while there may be many ABAP servers
- INDEX: Creation of Index for improving performance should not be taken without thought. Index speeds up the performance but at the same time adds two overheads namely; memory and insert/append performance. When INDEX is created, memory is used up for storing the index and index sizes can be quite big on large transaction tables! When inserting new entry in the table, all the index's are updated. More index more time. More the amount of data, bigger the indices, larger the time for updating all the indices
- Avoid Executing an identical Select (same SELECT, same parameter) multiple times in the program. Buffer in your abap code.
- Avoid using join statements if adequate standard views exist no performance impact
- TABLE BUFFER:
- Defining a table as buffered (SE11) can help in improving the performance but this has to be used with caution. Buffering of tables leads to data being read from the buffer rather than from table. Buffer sync with table happens periodically, only if something changes which is happen rarely. If this table is a transaction table chances are that the data is changing for a particular selection criteria, therefore application tables are usually not suited for table bufferung. Using table buffering in such cases is not recommended. Use Table Buffering for configuration data and sometimes for Master Data..
- Avoid using complex Selects on buffered tables-, because SAP may not be able to interpret this request, and may transmit the request to the database- The code inspector tells which commands bypass the buffer
- Internal tables
- Use HASHED tables where-ever possible. Otherwise SORTED tables. STANDARD tables should be the last choice.
- Use assign instead of into in LOOPs for table types with large work areas, if the data is being modified.
- When in doubt call transaction SE30/SAT and check your code.
- If you must use a STANDARD table and you are using a READ, sort the table appropriately and use the addition BINARY SEARCH to speed up the search.
- http://wiki.scn.sap.com/wiki/display/ABAP/ABAP+Performance+and+Tuning
- Use SLIN and code inspector tools.
No comments:
Post a Comment