Open mikemccllstr opened 11 years ago
As reported by Rabid on http://forum.dominionstrategy.com/index.php?topic=6106.msg165102#msg165102, looks like the breaking point with the current code, hosting, and data volume lies between 4500 and 5000 games:
-Stef-
(2738 games) http://councilroom.com/popular_buys?player=-Stef-
TheSadPanda
(4547 games) http://councilroom.com/popular_buys?player=TheSadPanda
papaHav
(5086 games) http://councilroom.com/popular_buys?player=papaHav
Rabid
(8325 games) http://councilroom.com/popular_buys?player=Rabid
chwhite
(9968 games) http://councilroom.com/popular_buys?player=chwhite
Implementation advice for this.
The basic idea is to give every[1] player their own count_buys.DeckBuyStats entry in the buys table. The pre-computing logic in count_buys gets a bit more complicated, because instead of maintaining a single global count_buys.DeckBuyStats, it also has to manage a dictionary keyed by player of DeckBuyStats. If you are going to do this incrementally, you might want to use the same updating strategy as in analyze2.EventAccumulator. Compute starting with an empty dict, and before writing, do a read and merge of the existing data per player, then write out the computed data. If committing day by day, this let's you skip reading players data who didn't play on a given day.
[1]If db space is a premium, you might want to get a little fancier and use a hybrid on the fly for infrequent players/precomputed for frequent players strategy. Say only give players who have some threshold, say 50 games, their own entry in the buys column, but then you have to manage tracking #games per player and have some fancy logic to decide when you should start storing the data. I am not sure this is worth it.
From Rob's post in councilroom-dev:
Not sure what is required to be precalculated in advance, but it is distinctly slow for users with large game counts.