@xiaoNiuNew The recommended approach is to page over the leaderboard or tournament records from the
RegisterTournamentEnd function in the server runtime:
You can page through the leaderboard or tournament at the end of its expiry by passing in the inputs to the registered function into
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.