matomo-org / matomo

Empowering People Ethically with the leading open source alternative to Google Analytics that gives you full control over your data. Matomo lets you easily collect data from websites & apps and visualise this data and extract insights. Privacy is built-in. Liberating Web Analytics. Star us on Github? +1. And we love Pull Requests!
https://matomo.org/
GNU General Public License v3.0
19.72k stars 2.63k forks source link

[Bug] How to adjust the Log Data deletion schedule #22246

Open nnhiep opened 4 months ago

nnhiep commented 4 months ago

What happened?

Currently, we have encountered a problem where at 2 PM every day, a job runs periodically to delete data according to the query below. This causes the database to peak in resource usage at that time, lasting for about 2 hours.

DELETE log_link_visit_action FROM matomo_log_link_visit_action log_link_visit_action LEFT JOIN matomo_log_visit log_visit ON log_link_visit_action . idvisit = log_visit . idvisit WHERE log_visit . idvisit IN ( ?+ )

What should happen?

How can I proactively set that deletion schedule to a different time?

How can this be reproduced?

N/A

Matomo version

5.0.1

PHP version

8.3.6

Server operating system

CentOS7

What browsers are you seeing the problem on?

No response

Computer operating system

No response

Relevant log output

No response

Validations

sgiehl commented 4 months ago

It's currently not possible to adjust the time schedule in the UI. But it could be a nice improvement of our TasksTimetable plugin, to also allow adjusting the timetable. Feel free to create a suggestion here: https://github.com/matomo-org/plugin-TasksTimetable/issues

As a workaround: I guess you are using a cron job for archiving, which also triggers the jobs? If so you could execute the cron with the parameter to skip all jobs at times where such jobs could cause problems.