FAForever/db

Achievement statistics are slowing down DB

Closed this issue · 1 comments

I've noticed that queries to player_achievements are slow.

There are some views (achievement_statistics, game_reviews_summary, ...), that are asking for percentage of unlocked achievements.

I offer is add statistics columns on achievement_definitions and count them once per time (not necessary needed to have triggers for that). We may use MySQL events https://dev.mysql.com/doc/refman/8.0/en/create-event.html + enable events in db.

Then remove all unlockers_min_duration, unlockers_avg_duration, unlockers_max_duration, players_that_have_achievement things from queries and views.

This resolution can coexist with existing solution and we can migrate slowly.

Fixed by #219