Currently, archiving a month in Piwik will sum the reports for all 30 days and sum all reports together. This is causing most of the php memory issues which start failing when summing all datatables for Pages URLs for a month for example. Instead, we should reuse the algorithm used to process date ranges, which select the minimum number of periods to use to process the enclosing period. So, a month would typically use 3 or 4 full weeks + the remaining ~5-10 days. This would result in up to 70% less datatables to select and sum! ie a month archiving would select 4 weeks archiving + 3 day archiving, or 3 weeks archiving + 10 days archiving, so either 7 or 13 archives, instead of 30...
See also related bug #4757
Perhaps this was fixed in your earlier fix to this algorithm?
We decided, after investigating for a few hours, that It is non trivial to make the change. Let's postpone for now.
would be nice to try again for 2.13.0 as it would make huge UI speed improvement difference for all date range requests