So I have a table that is holding all the scores individually by hole what I would like to do is show the average score of a particular course.
What I am worried about is the time that query is going to take if I have to
SELECT count(id) from round where course_id = $course
This will give me the number of rounds played for this course
SELECT * from hole_score where course_id = $course
That will give me all the holes played on a particular course
now I would have to have the php code add up all the scores into a round score then add up all the round scores and divide by the number of rounds. while it would seem easy and not very taxing with just this but also I need to add up all the PUTTS, FAIRWAYS and Greens in Regulations as well so I am worried that let's just say 100 rounds are played on this course
that's 1800 holes it has to go through and do 4 calculations on seems a lot to ask on more then one page of my site
Now I would like this number to be as dynamic as possible and I guess what I am wondering is should I have this set of numbers for each individual course updated when someone adds a round and store in a table like course_average and then just do a select then. or lose the real time feature and have it close to real time by having a cron job run in the middle of the night to update this table. Or am I just worrying to much and mysql/ php will be able to handle this no problem until the numbers get into the millions?