cancel
Showing results for 
Search instead for 
Did you mean: 

Is SELECT * statement selecting all OR only Target fields in SAP HANA v1 ?

Former Member
0 Kudos

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.

Accepted Solutions (1)

Accepted Solutions (1)

pfefferf
Active Contributor

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

Answers (0)