Cleanup the civicrm_activity table
A type of cleanup that I have found useful, is to "NULL" the details field on the civicrm_activity
table.
This query is pretty useful to find what is taking so much space:
select count(*), activity_type_id from civicrm_activity where details is not null group by activity_type_id;
Likely culprits are:
- Scheduled Reminders
- Print/Merge PDF Letter
To limit the data "loss", setting the details to NULL frees up most of the space. For example:
update civicrm_activity set details = NULL where activity_date_time < '2022-07-01 00:00:00' and activity_type_id = 22;
optimize table civicrm_activity;
This helped me free 3 GB on a few sites. The table went from 3.5 GB to 250 MB.