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.
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