When Matomo (Piwik) is setup to delete old logs, after the log deletion, we will run OPTIMIZE queries to claim the lost Mysql space on the database tables. These queries can be very slow to run and can cause problems on extremely large Matomo servers. If you see SQL queries and the server load going up out of control, with queries queueing because of an OPTIMIZE TABLE query, we recommend to disable all OPTIMIZE TABLE queries. To do so, edit config/config.ini.php and add:


Note: Matomo will never OPTIMIZE table which are Innodb, we will only OPTIMIZE tables of the Myisam type.