cancel
Showing results for 
Search instead for 
Did you mean: 

SAP HANA | With Clause performance

former_member565459
Participant
0 Kudos

We are using SAP HANA 1.0 SPS12.

We have daywise table like below -

select trans_date,article,measure1,measure2 from table_1

Volume of table ~ 5 millions rows

we need to see data like -

Performance wise is it better to use WITH CLAUSE and hold data for one year and then split according to timeframe? OR Is it better to use separate aggregation for each timeframe as shown above.

As far as I understand, in RDBMSs like Oracle, WITH CLAUSE materializes results and use it from the memory. SAP HANA is In Memory database itself. Does using WITH CLAUSE in SAP HANA gives distinctive performance edge?

select 'day-1',sum(measure1),sum(meaure2) from table1 where trans_date=add_days(current_date,-1) group by 'day-1'
union all
select 'day-2',sum(measure1),sum(meaure2) from table1 where trans_date=add_days(current_date,-2) group by 'day-2' 
union all
select 'WTD',sum(measure1),sum(meaure2) from table1 where trans_date=add_days(current_date,-7) group by 'WTD'
union all
select 'WTD-1',sum(measure1),sum(meaure2) from table1 where trans_date=add_days(current_date,-15) group by 'WTD-1'

Accepted Solutions (0)

Answers (0)