I am running the archiving cron job every 5 minutes, but each query uses a 24 hour interval like this one:
... WHERE log_link_visit_action.server_time >= '2014-02-16 22:00:00' AND log_link_visit_action.server_time <= '2014-02-17 21:59:59' AND log_link_visit_action.idsite = '1' AND log_link_visit_action.idaction_name IS NOT NULL AND log_link_visit_action.idaction_event_category IS NULL ...
By saving the time when auto-archiving was ran the last time and using that in the queries we can make them up to 10 times faster. My tests show about 0.6 seconds needed for a 2 hour interval and 5 seconds for 24 hours one.
Ok, after analyzing the way Piwik works it looks like this gives the daily values. But do we really need to rerun the fairly complicated daily query each time the archiving cron job starts?
Please don't use trac to ask questions about Piwik, use forums: http://forum.piwik.org