A
A
Andrey Strelkov2019-02-25 19:45:24
MySQL
Andrey Strelkov, 2019-02-25 19:45:24

Is it possible to set events in MySQL to have a periodic precise time value?

Good afternoon, please tell me, the database server needs periodic execution of tasks, and then the question arose, is it possible to run a certain event, for example, not every 10 minutes, but for example exactly at:
10:00:00
10:10:00
10: 20:00
...
or
10:01:00
10:11:00
10:21:00
_ how to accurately divide the events among themselves, it’s just that as I understand it, if an interval of 10 minutes is made for both tasks, and even if you specify that the first one starts at 10:00, and the second from 10:01, then it’s worth, let’s say, restart the database server in a week, then the tasks will start immediately at startup and the next time both will start exactly in 10 minutes, it turns out together
After all, MySQL is allowed at the current time of 11:00 and restarting the server, it will not wait for the next day and the time is 10:00 or 10:01, and it will not try to guess that since the time is made at 10:00 and at 10:01, then it turns out that I can start the first task at 11:00, and the second at 11:01

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
bkosun, 2019-02-25
@bkosun

If a process that runs several times can disrupt the system - block the possibility of its execution, something like this (pseudocode):

processes
id, name, processed, ...

if($process->processed < time() - Date::HOUR * 24){
execute()...
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question