Optimizing Mysql to avoid redundancy but still have fast access to calculable data

Posted by diglettpotato on Stack Overflow See other posts from Stack Overflow or by diglettpotato
Published on 2010-05-15T13:55:17Z Indexed on 2010/05/15 14:24 UTC
Read the original article Hit count: 220

Filed under:
|

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?

© Stack Overflow or respective owner

Related posts about mysql

Related posts about redundancy