I have a query in the form:
select a, b, c, d, e, f, g, h,
row_number () over (partition by a, b order by c, d, e, f) as order
from table;
And it's performance is kind of terrible.
We have tried creating 2 indexes, the first for the partition by columns (a and b) and the second for the order by columns (c, d, e, f).
Using the explain plan we have found that indexes are not being used. Altough they are usefeul for other querys with a group by clause.
Any idea on how to refactor the query, or re-create the indexes so that they help with performance on this query?
Thanks in advance