Users earn points, I need to display the article for a day, a week, two weeks, month, etc.
I.e. how much they added and in what category.
I was thinking only this: whenever the insertion point to write into a separate table, id, score, category, date. But I'm afraid it's stupid or awkward. Smart people please tell me this option is very bad and like better?
If such data is too much, you can switch to another DBMS, like clickhouse.
keira_Murray answered on March 12th 20 at 08:14
RabbitMQ/Kafka - bullet back event type of "action this" for those actions that affect the statistics.
Create a few listeners that I recalculate the statistics and placed in these tables (Yes, they have to be according to the types day,week, month,year as you want to get)
When outputting just get the tapes and feel the difference
You can recalculate statistics for cron, but with a large amount can be the lining
irma answered on March 12th 20 at 08:16
You can save just for a specific formula. What people at this point average score and how many parts it consists. For example there were only 3 asciwosci with scores 3, 2 and 1. The average score comes out 2. Saved 2 as the average score and 3 - number acepack. Next is track 5, and have saved 2(GPA), and 3(number) => 2 * 3 + 5(new estimate) = 11 / 4 = 2.75. 2.75 persistent and prolonged counters count by 1.
What to do with these numbers is up to you. To keep updated for weeks, months, years. A lot of places it won't hold.