cancel
Showing results for 
Search instead for 
Did you mean: 
Subscribe

Hi guys, recently, I encountered a strange issue. I have an analytic CDS query to derive records from VBAP, the currency conversion function bring heavy performance issue. I added 'Case ... when' in CDS view and compared the input currency and item currency, if they were same, returned the amount directly without conversion. And in test system, we had 800,000+ VBAP records. ( EUR had 700,000+ records, USD had 100,000 records) . I tested the performance in HANA studio (SQL) and GW client (server request) by passing EUR and USD, there was no different. Logically, if passing 'EUR', it should be faster as it has less records to do the conversion. eh...., not sure how the HANA works with it. I really appreciate if anyone has any experience or idea about this case. Thanks in advance!

View Entire Topic
Joerg_Brandeis
Contributor

Hi Eugene,

to find out the truth, you have to analyze the execution plan. But I have some suspicions.

I think it is due to the fact that the SQL function CONVERT_CURRENCIES in SQLScript still internally calls the obsolete CE function CE_CONVERSION. This function works on table level and not on row level. See SAP documentation.

If this suspicion is correct, you could separate the table into two halves:

  • One where both currencies are the same and
  • The other with the rest of the records, where you can apply the CONVERT_CURRENCIES

And I would merge them again at the end with a UNION_ALL.

If you try this, please post the result! It would be interesting to see if this was successful.

Regards,
Jörg

eugene_517
Product and Topic Expert
Product and Topic Expert

Hi Brandeis,

Thanks a lot for your analysis, I really appreciate it. I tried your idea and compared the performance. It did be more faster, the performance was improved about 25%~30%. Currently, I guess this might be the way to improve the performance for this case. The behavior of SAP HANA SQL execution is very confusing. Anyway, thanks for you great idea.