I have a query which has a paging functionality and for which i'm using ROW_NUMBER() function. The order by clause in my rownumber function is dynamic and gets changed all the time when ever the sp is called. It works fine for few columns but for one column
which is of datetime datatype, it takes lot of time. Amazing thing is with when i sort by the same column in descending order, the query runs in a sec but ascending order takes lot of time :(.
I tried creating a non clustered index(as i already i have a clustered index on that table) on that datetime column but it did not help me.
Could you please suggest what i can do to improve the performance.
View Complete Post