Backend Index efficiency (leaderboard)

My website has a leaderboard function, and I want all users to be able to see their rank on their personal dashboard. The rank is dependent on their high score, and the user with the highest high score is number 1 on the leaderboard and so on. It is enough if this leaderboard is updated once daily, but it would be good if it’s done on the backend. Importantly, the leaderboard score has to be stored in the database, so that I can integrate it on everybody’s dashboard.

Currently, I have implemented this with the help of the “1T - Index Finder” Plugin, which is great! (1T - Index Finder Plugin | Bubble) Basically, once a day, a recurring workflow is run on each user, where the plugin orders all users by their high score and then searches the current user and saves their index to the database. That works well, but it leads my application to be at capacity every day for 90 minutes. I guess that’s because the ordered list is created again for every user, although it would suffice to create it only once.

As my number of users grows, I am a bit worried about the server capacity. Therefore, I wanted to ask: Does somebody know of a more efficient solution for this process, perhaps?

1 Like

A better solution in my opinion is to create a API workflow that takes user and rank as input.
Then, whenever you want to update the ranking, sort the list of users based on the score and run that API workflow on the sorted list:

In this method, searching and sorting will be done only once.

I gave a brief explanation, if needed, tell me so that I can give a more complete explanation.

Hi NoCodeDataArtisan,

Thank you so much!
I tried and it works perfectly.

1 Like

you’re welcome,
It’s good that I was able to help you

Hello, I want to do the same thing you have accomplished, it is a bit hard for me to understand how to implement it step by step, could you please tell me a bit more or provide screenshots?
Thank you