Database pressure

Sorry for my pool Engilsh. :smiley:
I build a game season system with tournament. When a tournament end, I need record some data of every player that joined the tournament as a history accomplishment, for example , the score and rank . But if traverse all records of the tournament when end to write data to database ,that maybe have huge pressure on database ?

Or can I retain a tournament’s records when it end? If can retain , I may no need to wirite all player’s history accomplishment data at the same time.

@xiaoNiuNew The recommended approach is to page over the leaderboard or tournament records from the RegisterLeaderboardEnd or RegisterTournamentEnd function in the server runtime:

https://heroiclabs.com/docs/gameplay-tournaments/#reward-distribution

You can page through the leaderboard or tournament at the end of its expiry by passing in the inputs to the registered function into LeaderboardRecordsList or TournamentRecordsList.

https://heroiclabs.com/docs/runtime-code-function-reference/#leaderboards

This paging behaviour limits the blocks of records retrieved from the database but also makes efficient use of KEYSET WHERE clauses to continue to process the next page of results without the need for a table scan. This design was specifically optimized to handle hundreds of millions of rows in an optimal way.

It does not guarantee that all records will be processed in the same “instant” though. I encourage you to fill the leaderboard with millions of rows and execute the rollover. Let me know if you have more questions on the design.

1 Like