I have records with:
User id, reputation
1 , 5
2 , 8
3 , 2
4 , 6
For User id 2, I want to get the user’s reputation and the index of the record using descend ordering of reputation. In this example the index of user 2 is 1, the index of user 4 is 2, etc.
I want the algorithm can process many users(10K at least), so the performance is a concern, please suggest.
You can reverse sort by
reputationFor performance of this query, create an index on reputation as: