Answer the question
In order to leave comments, you need to log in
What is the best way to implement rating?
Help me choose between two options or offer your own.
There are user activities (votes, purchases, comments, etc.) that affect the rating by adding or subtracting some x from the rating.
Actually option 1:
store the amount in the database, an example of a table is
user_id (int11), rating(int8), count(tynyint3), date(datetime)
rating - final rating
count is the number of actions per day, date is the date of the first of them, this is to set limits on daily activities (purchases naturally do not count here) option 2
:
store in the activity database
user_id (int11), rating(tynyint3), type(tynyint3), date(datetime)
rating - rating change, positive or negative number
type - type of activity, somewhere in a separate database to store types of activities with a description
date - datetime of
activity 5M+ records will accumulate there. But I can not understand how resource-consuming the second option will be.
What do you advise?
Answer the question
In order to leave comments, you need to log in
I agree with the option of combining both into one.
Then, if necessary, you can recalculate the rating.
And if anything - the final rating can be stored in the muscle base, and separately - in the same mongo for example. If the performance is very high - this option has the right to life.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question