W
W
WAYNEDEV2021-09-14 18:25:52
SQL
WAYNEDEV, 2021-09-14 18:25:52

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

1 answer(s)
D
Dmitry Bay, 2021-09-15
@WAYNEDEV

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 question

Ask a Question

731 491 924 answers to any question