{"action":"created","issue":{"url":"https://api.github.com/repos/piwik/piwik/issues/7468","labels_url":"https://api.github.com/repos/piwik/piwik/issues/7468/labels{/name}","comments_url":"https://api.github.com/repos/piwik/piwik/issues/7468/comments","events_url":"https://api.github.com/repos/piwik/piwik/issues/7468/events","html_url":"https://github.com/piwik/piwik/pull/7468","id":62583196,"number":7468,"title":"Faster archiving by calculating the recursive count only if needed","user":{"login":"tsteur","id":273120,"avatar_url":"https://avatars.githubusercontent.com/u/273120?v=3","gravatar_id":"","url":"https://api.github.com/users/tsteur","html_url":"https://github.com/tsteur","followers_url":"https://api.github.com/users/tsteur/followers","following_url":"https://api.github.com/users/tsteur/following{/other_user}","gists_url":"https://api.github.com/users/tsteur/gists{/gist_id}","starred_url":"https://api.github.com/users/tsteur/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tsteur/subscriptions","organizations_url":"https://api.github.com/users/tsteur/orgs","repos_url":"https://api.github.com/users/tsteur/repos","events_url":"https://api.github.com/users/tsteur/events{/privacy}","received_events_url":"https://api.github.com/users/tsteur/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/piwik/piwik/labels/c:%20Performance","name":"c: Performance","color":"ededed"},{"url":"https://api.github.com/repos/piwik/piwik/labels/Needs%20Review","name":"Needs Review","color":"fad8c7"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-03-18T03:53:13Z","updated_at":"2015-03-18T04:58:45Z","closed_at":"2015-03-18T04:58:22Z","pull_request":{"url":"https://api.github.com/repos/piwik/piwik/pulls/7468","html_url":"https://github.com/piwik/piwik/pull/7468","diff_url":"https://github.com/piwik/piwik/pull/7468.diff","patch_url":"https://github.com/piwik/piwik/pull/7468.patch"},"body":"The method `ArchiveProcessor::aggregateDataTableRecords` counts by default the number of rows recursive. I noticed this takes a lot of time especially on large dataTables: https://github.com/piwik/piwik/blob/2.12.0-b7/core/ArchiveProcessor.php#L220\r\n\r\nWe're calling this method 17 times but it is only actually used once. Therefore I added a parameter to disable it (not enabled by default to stay BC. I failed to find a better solution. Only solution I could think of alternatively would be to add another method that does not count recursive.\r\n\r\nIn the following example run you can see that it takes 13.5 seconds (with xhprof and only no_builtins flag) which is 15% of the total time to get the rows count recursive. And this is only for 5 records. Those 17 calls easily make 30 records. Meaning we will save a lot of time when generating week, month, year and range archives.\r\n\r\n![getrowscountrecursive](https://cloud.githubusercontent.com/assets/273120/6702302/5e420afe-cd8e-11e4-904c-85cd7262dec6.png)\r\n)"},"comment":{"url":"https://api.github.com/repos/piwik/piwik/issues/comments/82739883","html_url":"https://github.com/piwik/piwik/pull/7468#issuecomment-82739883","issue_url":"https://api.github.com/repos/piwik/piwik/issues/7468","id":82739883,"user":{"login":"mattab","id":466765,"avatar_url":"https://avatars.githubusercontent.com/u/466765?v=3","gravatar_id":"","url":"https://api.github.com/users/mattab","html_url":"https://github.com/mattab","followers_url":"https://api.github.com/users/mattab/followers","following_url":"https://api.github.com/users/mattab/following{/other_user}","gists_url":"https://api.github.com/users/mattab/gists{/gist_id}","starred_url":"https://api.github.com/users/mattab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattab/subscriptions","organizations_url":"https://api.github.com/users/mattab/orgs","repos_url":"https://api.github.com/users/mattab/repos","events_url":"https://api.github.com/users/mattab/events{/privacy}","received_events_url":"https://api.github.com/users/mattab/received_events","type":"User","site_admin":false},"created_at":"2015-03-18T04:58:45Z","updated_at":"2015-03-18T04:58:45Z","body":":+1:"}}