Is it safe to delete old data in matomo_log_link_visit_action?

Hello,

As long as the core:archive cron has already run, am I right to say that it’s safe to delete old data from matomo_log_link_visit_action, and I will keep all the daily stats for Events, Visitors, etc?

I’m not finding any documentation of what this table really contains, or what am I really losing, if I delete data from this table.

I do see this link - https://matomo.org/faq/troubleshooting/faq_42/
but it’s not clear whether “Raw Data” refers to the matomo_log_link_visit_action table.

Does deleting this table just impact “Visits Log”?

  • matomo_log_visit - the Visits themselves
  • matomo_log_link_visit_action - the breakdown/details, pages visited, etc, of each of those Visits?

If I run core:archive every hour, and delete data in matomo_log_link_visit_action after a few months, I should be fine, is that correct?

Thank you!

Hi @ghnp5

Yes, but not only. Also Matomo visit tables. And maybe also orphans action (ie the ones not linked to a link anymore…?) rows (not sure).

The archiving process will only process data for:

  • Current unfinished periods (eg. current day, current month, etc.).
  • Past finished period if they have never been totally processed (eg. yesterday data if the archiving process is the first one of “today”).
  • Past periods if they have been invalidated.

Then if you want to process data for the whole year it can be safe to keep enough old raw data, especially for the “unique” metrics as unique visitors for example.
Also if you want to have the detail of visits (visit log), their data must not be deleted.

I would suggest you use the Matomo UI or console command to delete old raw data instead of do direct SQL query, as Matomo knows which data to keep or not.

1 Like

Thank you very much! I see the option now.

Just one question - does it run small “DELETE” statements in batches, or does it do a huge “DELETE” statement?

I’m just wondering because I have loads of visits every day, and as the table is huge, running one single DELETE without “LIMIT 5000” will basically lock the table.

I’ve done the first purge, manually, and ran it in batches of 5000. Took several hours to complete, but at least it didn’t lock :slight_smile:

Thank you very much!