Quantcast
Channel: SCN : Discussion List - SAP HANA Developer Center
Viewing all articles
Browse latest Browse all 6412

CV Aggregate Minimum after Filter leads to poor performance

$
0
0

Hello,
I have to get the last day of a month provided trough an input parameter. After this I have to filter all (Inverted)dates that are prior this date. On this filtered list I want to create an minimum aggregation which leads to incredible bad performance in a CV. In fact HANA uses almost 100% of the CPUs and I was always forced to cancel the request before I got a result.

 

Unbenannt2.PNG

If I switch the Aggregation from MIN to SUM it is fast again.

 

In SQL the performance is ok. The SQL would be following:

 

Select "Global_Material",

  min("Valid_From_inverted") AS "MinValidFrom_inverted"

from

  "XXX"."T_MAT"

where

  "Valid_From_inverted">=(99999999-TO_INTEGER(REPLACE(TO_VARCHAR(Last_Day(TO_DATE(:PERIODDATE, 'YYYY-MM-DD'))),'-','')))

group by

  "Global_Material"

 

Are there better ways to model this query(except SQLScript)? 


Thanks
Patrik


Viewing all articles
Browse latest Browse all 6412

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>