Skip to Content
Former Member
Jul 07, 2014 at 01:36 PM

Rank Function taking a long time to execute in SAP HANA


Hi All,

I have a couple of reports with rank function which is timing out/ or taking a really long time to execute, Is there any way to get the result in less time when rank functions are involved?

the following is a sample of how the Query looks,

SQL 1:

select a.column1,


rank () over(partition by a.column1 order by sum(b.column2) asc)

from "_SYS_BIC"."Analyticview1" b

join "Table1" a

on (a.column2 = b.column3)

group by a.column1,


SQL 2:

select a.column1,


rank () over( order by min(b.column1) asc) WJXBFS1

from "_SYS_BIC"."Analytic view2" b

cross join "Table 2" a

where (a.column2 like '%a%'

and b.column1 between 100 and 200)

group by a.column1,


when I visualize the execution plan,the rank function is the one taking up a longer time frame. so I executed the same SQL without the rank() or partition or order by(only with Sum() in SQL1 and Min() in SQL 2) even that took a around an hour to get the result.

1.Does anyone have an any idea to make these queries to execute faster?

2. Does the latency have anything to do with the rank function or could it be size of the result set?

3. is there any workaround to implement these rank function/partition inside the Analytic view itself? if yes, will this make it give the result faster?

Thank you for your help!!