I have an online rugby manager game. Every registered user has one team, and each team has 25 players at the beginning. There are friendly, league, cup matches.
I want to show for each player page the number of:
- official games played,
- tries,
- conversions,
- penalities,
- dropgoals
and for each of the categories:
- in this season;
- in his career;
- for national team;
- for U-20 national team
I have two options:
$query = "SELECT id FROM tbl_matches WHERE type='0' AND standing='1'";
$query = mysql_query($query, $is_connected) or die('Can\'t connect to database.');
while ($match = mysql_fetch_array($query)) {
$query2 = "SELECT COUNT(*) as 'number' FROM tbl_comm WHERE matchid='$match[id]' AND player='$player' and result='5'";
$query2 = mysql_query($query2, $is_connected) or die('Can\'t connect to database.');
$try = mysql_fetch_array($query2);
}
This script searches every official match played by the selected player. Then gets the report for that match (about 20 commentary lines for every match) and check every line if the searched player had scored a try.
The problem is that in a few seasons there could be about 20 000 000 row in commentary page. Will my script load slowly (notable by users)?
The second option is to create a table with player stats, who will have about 21 cols.
What do you recommend that I do?