I am not sure what can I delete


I am having a problem with purging the data. The problem is that I am not sure if I loose important data by running the script ./console core:purge-old-archive-data all

The size of the database is huge. That’s the reason to purge. We are also migrating the Matomo to new server and this is a good time for us to purge the data.

I have a regular cronjob for archiving the logs (./console core:archive).

I would like to keep all the data since the 1.1.2020.

I would appreciate if you can help me.

Matomo: 3.14.1
MySQL: 5.5.62
PHP: 7.1.33


This is solved now!

In the mysql console I run:

select table_name, round(data_length/1024/1024) as data_length_mb, round(data_free/1024/1024) as data_free_mb from information_schema.tables where round(data_free/1024/1024) > 200 order by data_free_mb;

…and then following the result:

optimize table piwik_log_visit, piwik_log_link_visit_action;

Running the optimization commands from the Matomo console did not do the trick (only around 2 GB reduced).

After running the optimization straight in the DB, the size of the DB dropped from 45 GB to 5 GB :grinning:

1 Like


I noticed this also a few days ago and it makes sense: Matomo can delete entries from the database, but the disk space MySQL uses often doesn’t decrease if the database size decreases unless you run an optimize on it.

1 Like