Q) What is "Performance Tuning"? Why do we need it?
Depending on the complexity and volumes of data, ABAP programs often are vulnerable to time-out issues and short dumps. Users, in general (SAP/Non SAP) get annoyed by time consumiung applicationsas they (the programs) often affect user productivity, TCO of software and many more critical factors pertaining to the management of the software. This is where the need "Performance Tuning" arises.
So, what exactly is Performance Tuning?
This simply means - ensuring that an ABAP program performs efficiently. A good ABAP program to bring the desired output to the user within the desired timeframe. Thus increasing the productivity of users, saving a lot of time and keeping the management happy in the bargain.
Q) List out the benefits of Performance Tuning/Optimization.
- Maximum user productivity
- Minimum time-outs
- Lower total cost of ownership - due to reduced timelines and increased productivity of users
- Faster ROI (return on investment)
- Easier upgradation
Q) List out the steps for Performance Tuning/Optimization.
Data declaration
- Remove all code and variables that are not used in the program
Avoid declaring internal tables using LIKE or TYPE reference. Instead, use BEGIN OF... ... END OF ITAB.
Avoid declaring internal tables using 'occurs 0' & 'with header line'
SELECTs & DB access
Use selection criteria to effectively select and limit the number of database reads
Select only those columns that are needed – Do not use a SELECT * unless necessary
To populate an internal table thru a SELECT, use the INTO TABLE addition
To update table entries, specify the columns
Design your SELECT Query to Use as much index fields as possible from left to right in your WHERE statement
Use a SELECT SINGLE if the primary keys are known, otherwise SELECT UPTO 1 ROWS
Do not use nested SELECTs – Use views, joins or the FOR ALL ENTRIES option
Avoid using INTO CORRESPONDING FIELDS OF TABLE. Instead use INTO TABLE.
Do not use SELECTs in loops
Restrict the database access by using the WHERE clause – do not use a CHECK
Use indexes wherever available
Avoid NOT in the WHERE condition
Do not select the same data more than once
Avoid the SELECT DISTINCT Statement. Instead use ABAP SORT + DELETE ADJACENT DUPLICATES on an internal table, to delete duplicate rows.
Processing data
Use aggregate functions wherever required instead of additional logic
Use sort on the internal table for small amounts of data and database ORDER BY for larger amount
Whenever using READ TABLE use BINARY SEARCH addition to speed up the search. Be sure to sort the internal table before binary search.
Use "CHECK" instead of IF/ENDIF whenever possible.
Use "CASE" instead of IF/ENDIF whenever possible.
Use "MOVE" with individual variable/field moves instead of "MOVE-CORRESPONDING"
Performing Checks
Perform the Extended Program Check
Perform Runtime Analyses
Q) List out the tools used Performance Tuning/Optimization.
- Run time analysis transaction SE30
This transaction gives all the analysis of an ABAP program with respect to the database and the non-database processing. - SQL Trace transaction ST05
The trace list has many lines that are not related to the SELECT statement in the ABAP program. This is because the execution of any ABAP program requires additional administrative SQL calls. To restrict the list output, use the filter introducing the trace list.
No comments:
Post a Comment