I have a restaurant review app which stores reviews in a db, MySql.
There's 2 tables. 1 for Restaurant. Another for reviews.
To increase the performance, I am considering to store the avg review of restaurant instead of calculating it on the fly.
I am not sure where to store that bit though. Should it go into Restaurant table or separate table?
I was thinking if I should create a new table called RestaurantStats to store more than just avg reviews, but is that overkill?
Is it safe to store the avg in main table?
Currently, I am getting around a thousand reviews per day now and expect it to swell in a few months.
I have to show avg of reviews for a list of restaurants by area.
As part of performance tuning, I have created a new table that notes which restaurants were reviewed and then a event is scheduled to run every x minutes to calculate the avg for restaurants that were recently reviewed so that I dont have to calculate avg on every request.
I have my db hosted on AWS, and want to keep the CPU usage down.