This thread got me thinking of a new solution for my rating-script.
As of now it's like this, I have one table where I store the score, total rates and what movie was rated, I also have an extra table where I store the user id and the movie id to keep track of which users have rated the particular movie(s).
This works fine and all but would this solution be better:
Add and extra column to my "main" table, let's name it "raters", and when a user rates a movie I insert their username or id there.
I would then use explode to get the users and see if they had rated the movie.
What would be better performance wise? Let's say we are dealing with 50.000 users (not the case) What is better, Have 50.000 rows in the keep-track-table or have 50.000 users(a lot of text/numbers ex: 1|2|412|2837918|1212) in the extra field "raters"?
movie_id (repeated for each review) | individual_score | scored_by_user
Then you can perform the calculations on the movie's score every time somebody wants to see it... mysql will cache the results so you don't have to worry about your computer performing the same calculation again and again...
It seems a little easier way of organizing and maintaining the information...
And on top of that, you can add a "review" column or something to the end of table2, allowing users to make quick comments regarding a movie..