execute report ZCRMS4_ORDER_SEARCH_PROD_SOLD with variant ISSUE:
It will take on average 16~18 seconds to finish the query. I execute the report 5 times with ST05 trace to get this average performance.
export the planViz file:
and open this file in HANA studio, it shows only 2.8 seconds is consumed. why?
When I paste the following SQL statement from ST05 into HANA studio and execute it there:
The performance is also quite good:
So why there is such a big performance gap when CDS view is read from ABAP and read from HANA studio? ( could only be directly executed, but not under visual plan )
set schema "SAPQGS";
set 'CDS_CLIENT'='300';
SELECT
/* FDA READ */
DISTINCT "CRMS4V_C_ITEM_OPT2" . "OBJECT_ID" , "CRMS4V_C_ITEM_OPT2" .
"DESCRIPTION" , "CRMS4V_C_ITEM_OPT2" . "POSTING_DATE" ,
"CRMS4V_C_ITEM_OPT2" . "GUID" , "CRMS4V_C_ITEM_OPT2" . "PRIORITY" ,
"CRMS4V_C_ITEM_OPT2" . "PRIORITY_TXT" , "CRMS4V_C_ITEM_OPT2" . "STATUS_ID"
, "CRMS4V_C_ITEM_OPT2" . "CONCATSTAT"
FROM
/* Entity name: CRMS4V_C_ITEM_OPT2 */ "CRMS4VCITEMODL2"
"CRMS4V_C_ITEM_OPT2" LEFT OUTER MANY TO ONE JOIN
/* Entity name: I_BUSINESSPARTNER */ "IBUSINESSPARTNER" "=es_100025" ON
"CRMS4V_C_ITEM_OPT2" . "MANDT" = "=es_100025" . "MANDT" AND
"CRMS4V_C_ITEM_OPT2" . "SOLD_TO_PARTY" = "=es_100025" . "BUSINESSPARTNER"
WHERE
"CRMS4V_C_ITEM_OPT2" . "MANDT" = '300' AND "CRMS4V_C_ITEM_OPT2" .
"PRODUCT_ID" = 'AB0000000042' AND ( RTRIM ( ABAP_UPPER ( "=es_100025" .
"LASTNAME" ) ) = 'WANG' AND "=es_100025" . "BUSINESSPARTNERCATEGORY" = '1'
OR RTRIM ( ABAP_UPPER ( "=es_100025" . "ORGANIZATIONBPNAME2" ) ) = 'WANG'
AND "=es_100025" . "BUSINESSPARTNERCATEGORY" = '2' )
LIMIT 100
Jerry has followed the proposal from HANA support colleague Phoebe to use fixed LIMIT value, that is, to use a hard code UP TO 100 ROWS. After that the performance in ABAP is now equal to in HANA studio - it takes only around 2 seconds to finish the query.
Unfortunately, this limit value is specified by end user from UI, we from application side should never hard code it in our code.