Question about: enable_sql_optimize_queries parameter


Is it possible to schedule enable_sql_optimize_queries (Optimize table) at specific time?

Thank you!


When you set enable_sql_optimize_queries, then Matomo will run OPTIMIZE scheduled after deleting old logs:

Is it possible to schedule this action at exact time? We have huge DB and deleting raw log data every day. Thank you.

Maybe in that case it is easier to disable the Matomo feature to run optimize and run optimize yourself on your own schedulde

Could you please advise where I could find information about Optimize queries which Matomo runs to delete old data? For example at the moment we delete raw logs older than 1 day. How I understand should be enough to just run OPTIMIZE TABLE query on matomo_log_visit and matomo_log_link_visit_action?

One more question will Matomo still delete old data even when enable_sql_optimize_queries disabled?

I guess enabling SQL logging should show you the exact queries Matomo runs:

Thank you for the information!

Also, found this tutorial -

Just curious if this console command:
./console database:optimize-archive-tables all
would replace enable_sql_optimize_queries