M
M
MilkyWay2014-05-29 17:25:53
MySQL
MilkyWay, 2014-05-29 17:25:53

Is there a way to update records in the database later?

There is some data that is updated in real time. Based on them, the values ​​are calculated, which are entered into the database on the basis that each user has his own set of resulting values.
Common sense suggests that doing UPDATEs for all users and recalculating values ​​in real time is irrational, because the data is displayed only for those who are logged in (and this is a very small part of the total number of users).
How, in such cases, do they act “according to science”, so that first of all, those who are online have up-to-date data, and for everyone else, the data is recalculated with a lower priority?
PS: The database is planned to use MySQL, but I'll be happy to hear about others if they help solve the problem.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
Ilya Lesnykh, 2014-05-29
@MilkyWay

You need a queue. From the script, the data is put (push) into the queue, and then the cron gets out of it (pull) and processed. Almost all the popular functionality of most highload projects (for example, a messenger) works there.

S
Steely, 2014-05-29
@Steely

What for such difficulties? Is it just not destiny to update records? How many updates per hour will you have?
And in general the queue will solve your problem?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question