Four little tips to improve SQL performance in ABAP
Tip 1:
1 |
SELECT INTO TABLE |
vs.
1 |
SELECT |
1 |
APPEND |
1 |
ENDSELECT |
Basically the query with
1 |
SELECT INTO TABLE itab |
is more efficient than the query
1 |
SELECT |
1 |
APPEND |
1 |
ENDSELECT |
However, when later processing the selected matches in a loop (LOOP) carried out, it may be better to carry out this process in the same
1 |
SELECT |
1 |
APPEND |
1 |
ENDSELECT |
Tip 2:
1 |
SELECT * |
should be used only as a last resort, as this data is stored in memory that are not subsequently used.
Better:
1 |
SELECT feld INTO … |
Tip 3:
1 |
SELECT SINGLE field |
This results in only one access to the database and is therefore much faster than other SELECTs.
Tip 4:
Use key fields
Actually self-explanatory. By specifying all possible key spring in the WHERE clause, the network load and memory usage can be reduced because there can be accessed in this way on existing indexes.