User statistics: "mutual calculation" or volume calculation + caching

I have a project that calculates a series of "statistics" about user productivity, and then shows them to them. All these statistics ultimately come from a large table of “interactions” that capture user interactions with the site. At the moment, all these statistics are calculated by viewing this data. We make extensive use of persistent caching to speed things up.

We are considering the transition to an “iterative design”, where statistical values ​​are stored in db, and when registering each interaction, we update the values ​​depending on the contribution of these interactions to each score, so we are essentially iteratively updating the values. (now we just pollute the cache).

I see some problems with iterative design, because it means that we have redundant, potentially not synchronized information stored in our database, which makes adding new statistics difficult and means a lot of work on each interaction log. The advantage is that it simplifies the statistical search to a single hit db!

Something in this iterative project is causing me alarms, but I cannot deny the potential benefits of saving time. Should I obey this gut feeling, or go ahead and do it?

+3
source share
3 answers

, , . (, , ). - SQL. , ( SQL- , ? SQL?).

, , ? //? , .

+1

, , , .

, , . 2 , .

, ,

0

- , , , .

, , ( ), :

, . , ( tblFoo update tblFooStats); .

I would think that the only real risk is mentioned this way: you cannot immediately add new statistics / calculations. If you cover it, life should be very enjoyable.

0
source

Source: https://habr.com/ru/post/1718241/


All Articles