Realtime Leaderboard with Multiple Submissions Per User


I’m looking to create a fairly responsive leaderboard of scores that needs to update as close to realtime as possible. Each player trying to get to the top of the leaderboard can submit multiple scores during the time the leaderboard is accepting scores (multiple times per hour/day) but I really only want to show the best attempt from each player on the leaderboard.

What is an efficient way to set up a realtime leaderboard that allows multiple submission per user but only returns the best per user that does not need to constantly search/filter for the best score from each player and replace worse scores with better scores with each submission?

My current solution includes a Score data type and Leaderboard data type in the Data section. The Score has a reference to the User and the point value for the score to sort by. Each time a score is submitted that may be worth considering to include on the leaderboard I am checking the scores currently on the leaderboard to remove any worse for that player than the one submitted (or if no other submission from that player exists) then I add the new score. This requires some fun searches/filtering that are costly/slow.

On a related note - Is there anyway to do a search for scores sorted by their point value, but only get one entry for each user? If so I think I could start to get away from needing a leaderboard type all together.

Do all of the attempts need to be stored per user or just the highest score that user made in this instance?

Do a search for Scores:grouped by User (aggregation should be max of score)


We do want to keep every score for historical/trending purposes

How can I do this in a workflow?

Put that expression wherever you want in your workflow… What’s your use case?

It looks like the result of that setup outputs a list of groupings rather than scores. I would like the score data to be made available to share with my apps retrieving it from the API. Is it possible to output the actual score data for each top score for each player using the group by and aggregation feature?


See post above to see if I did that right

Sadly it seems this method is pretty slow to aggregate and also fairly spendy from a processing standpoint. So still looking for a better semi-realtime option for this