Answer the question
In order to leave comments, you need to log in
How to organize a user rating system in node + sql?
Hello! I want to figure out how to make a rating system on a 5-point scale
. The plan is this:
- Create a table with ratings ratings with properties: user_id, value, created_at, updated_at
- When reading a certain user, take all rows from the ratings table and display the average number
Question:
Is the structure correct? I'm afraid for optimization in the future, when the tables grow enough
. If you have experience or better ideas, I will be very grateful!
Answer the question
In order to leave comments, you need to log in
Normal scheme, and if there are performance problems, then make a cache in the user table or in an external cache.
Those. Roughly speaking, if you don't need a user's online rating, then make it a field in his table, and update the crown every 60 * x minutes.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question