on 2017 Jan 03 5:28 PM
Hello All,
our system is migrated to HANA and we try to optimize our programs by reducing number of selected table-fields.
Is there a difference in performance between reducing number of selected fields vs number of fields in target (work area, table, etc..)
Please check an example below, is there any difference in speed between query a) and b):
REPORT test.
DATA: BEGIN OF gs_mara,
matnr TYPE matnr.
DATA: END OF gs_mara.
" a)
SELECT * INTO CORRESPONDING FIELDS OF gs_mara
UP TO 1 ROWS
FROM mara.
ENDSELECT.
" b)
SELECT matnr INTO CORRESPONDING FIELDS OF gs_mara
UP TO 1 ROWS
FROM mara.
ENDSELECT.
Thanks and nice 2017 to everyone
Alex.
Statement b is more efficient cause HANA only has to process only one column instead of several ones. The columns in the target structure/table are not restricting the fields considered by the select on DB level, so the first statement would select all fields and on the ABAP layer the target structure is filled.
In your example the performance difference will not be very big, cause you are selecting only one line. But with examples selecting more lines you should be able to see a clear difference doing a performance trace.
To have a more optimized statement you should also avoid SELECT ... ENDSELECT and the INTO CORRESPONDING FIELDS clause for statement b. Many performance related issues can be detected using Code Inspector check variant PERFORMANCE_DB.
Regards,
Florian
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
65 | |
10 | |
8 | |
7 | |
6 | |
6 | |
6 | |
6 | |
6 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.