Most of Piwik when archiving will generate DataTables and then apply a sort and truncation filter before storing them as records. This is highly inefficient when dealing w/ DataTables w/ thousands of rows, since every one of those rows will have to be first allocated & constructed then sorted.
As done in the Actions plugin it is possible to apply ordering through the SQL and then use new DataTable functions to limit the number of rows in a DataTable w/o having to create and sort every possible one. This technique should be used everywhere possible.
It should be used for all reports that are bigger than normal: Custom Variables, Geoip reports, Actions, Referrers.
Not planned at this stage as we lack resources. You are welcome to sponsor this work if you want to get it done, or send a patch....
Get in touch for more info at email@example.com or http://piwik.org/consulting/
This issue was fixed in 2.12.0!