Optimizing Mysql to avoid redundancy but still have fast access to calculable data
- by diglettpotato
An example for the sake of the question: I have a database which contains users, questions, and answers. Each user has a score which can be calculated using the data from the questions and answers tables. Therefore if I had a score field in the users table, it would be redundant. However, if I don't use a score field, then calculating the score every time would significantly slow down the website.
My current solution is to put it in a score field, and then have a cron running every few hours which recalculates everybody's score, and updates the field.
Is there a better way to handle this?