New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add option to archive january archive of this / last year #14064
Comments
There is a command We also run Optimize automatically sometimes but usually not when it is InnoDB unless it is MariaDB |
I recommend you set up a cronjob maybe to do it monthly for example. |
I've tried that command. Options 'all', 'now', hidden Last option is specify concrete months. But it is also hard generate month in shell script. But finally I found solution: However I still think Matomo could be run in this predictable (deleting daily, but keeping monthly or yearly reports) time when optimization is very useful. Maybe checkbox at Keep all data for. |
I'm not sure if We could enable it for InnoDb for archive tables only. Log tables be too risky re downtime etc. Would for sure not enable it for log tables. In general, personally, I would disable Re the command: I think in general So it would be definitely good to add an option for |
Put it into 3.10 as it would make it our optimize tables much more efficient by not optimizing all tables again and again. |
Yes, it should be enabled for archive tables only because of predictable high data savings and because of locking of archive tables would only disrupt Matomo dashboard, not tracking. For predictable, I mean it could shrink tables ~35 times! (30 day + 4 weeks + 1 month ->1 month aggregated info. It is assuming 1 day takes about same amount of space as 1 week or 1 month). For January, it would be ~18x savings, as it will contain 1 year + 1 month. After removing daily data, these tables usually won't be written anymore, so it is good time prepare for long term storage by running one last final optimization and this would remove need for optimizing all tables again and again without predicted outcome. For log tables, locking is problem, also savings are unpredictable because sites traffic can increase/decrease, also space will be reused after deleting data. Optimization here is manual decision. |
If the There's no guide for the optimize tables command on matomo.org at the moment, so perhaps we should write some so that we can document this properly. |
For now created a short new section in edited After reading #10439 also updated the doc to list another command as well, that may free DB space: What do you think is the next step for this issue @katebutler ? |
But it just optimizes all dates independently if it was purged or not any data. matomo/plugins/CoreAdminHome/Commands/PurgeOldArchiveData.php Lines 110 to 124 in 52f4230
|
@mattab Thanks, I'll flesh out that doc a bit more and explain the options that are available, think that's all we need to do. |
Do you maybe have an update on this one @katebutler? |
Suggested addition to the https://matomo.org/docs/managing-your-databases-size/#purging-and-optimizing-the-database-using-a-console-command section - I don't have WP access so @tsteur can you please add it? To reduce execution time, you can select specific date periods to run these scripts for. This means that you can target just the recent months, for which report data is likely to have changed. Note that data for annual reports is stored in the archives for January of the appropriate year, so it is a good idea to optimize these regularly as well, e.g.
|
Cheers, done. |
I have set:
innodb_file_per_table=ON
.After Matomo deleted old data, but left yearly/monthly reports, table size for
piwik_archive_blob_2017_01
reported by phpMyAdmin reduced 150MB to 4MB. However actual.ibd
size left 150MB.After running
OPTIMIZE piwik_archive_blob_2017_01
, the.ibd
file was rebuilt and now takes 4MB.You can see data, index and free space by running
Could Matomo run
OPTIMIZE
on archive tables after deleting much data?In my case it reduced Matomo total DB space 4GB to 1GB.
The text was updated successfully, but these errors were encountered: