view - The best practices for aggregation and storing aggregated data in SQL SERVER -
i have table playercards(football cards, yellow/red) many rows. 3 rows example :
id | playerid | matchid | cardtype | minute ------------------------------------------- 1 | 10 | 134 | yellow | 56 2 | 12 | 134 | red | 89 3 | 11 | 134 | yellow | 71
i have table playergoals many rows. 3 rows example
id | playerid | matchid | goaltype | minute | assitid ----------------------------------------------------- 1 | 10 | 134 | penalty | 34 | null 2 | 12 | 134 | null | 44 | 16 3 | 11 | 134 | null | 48 | 18
and there other table player's actions data.
i need show website users variations of aggregated data. example:
- for each match each users numbers of goals, cards, playedminutes , on.
- sum of goals in season, sum of cards, minutes etc.
- avg of goals per match, avg of cards.
data updated after end of match. each player every 3-5 days.
i need best practices, advices how calculate these aggregations , store it.
i need precalculations before showing users
i think indexed sql view or maybe custom table , recalculate stored procedure or own application.
Comments
Post a Comment