{"action":"closed","number":7613,"pull_request":{"url":"https://api.github.com/repos/civicrm/civicrm-core/pulls/7613","id":56449052,"html_url":"https://github.com/civicrm/civicrm-core/pull/7613","diff_url":"https://github.com/civicrm/civicrm-core/pull/7613.diff","patch_url":"https://github.com/civicrm/civicrm-core/pull/7613.patch","issue_url":"https://api.github.com/repos/civicrm/civicrm-core/issues/7613","number":7613,"state":"closed","locked":false,"title":"Improve subquery performance.","user":{"login":"andy-walker","id":6890618,"avatar_url":"https://avatars.githubusercontent.com/u/6890618?v=3","gravatar_id":"","url":"https://api.github.com/users/andy-walker","html_url":"https://github.com/andy-walker","followers_url":"https://api.github.com/users/andy-walker/followers","following_url":"https://api.github.com/users/andy-walker/following{/other_user}","gists_url":"https://api.github.com/users/andy-walker/gists{/gist_id}","starred_url":"https://api.github.com/users/andy-walker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andy-walker/subscriptions","organizations_url":"https://api.github.com/users/andy-walker/orgs","repos_url":"https://api.github.com/users/andy-walker/repos","events_url":"https://api.github.com/users/andy-walker/events{/privacy}","received_events_url":"https://api.github.com/users/andy-walker/received_events","type":"User","site_admin":false},"body":"Have been investigating a problem with slow queries for one of our clients and have narrowed it down to this subquery in CRM/Case/BAO/Case.php, which queries all activities on the system then attempts to join the results of the main query onto them, resulting in some very slow queries.\r\n\r\nLooking at the condition for the join which follows that, it seems it's only looking for results that are linked to a Case, so can we restrict the subquery by means of an INNER join?\r\n\r\nSeems to me this won't have any effect on the end result of the query, but do double-check my logic in case I'm missing something.","created_at":"2016-01-19T10:48:31Z","updated_at":"2016-01-21T22:03:10Z","closed_at":"2016-01-21T22:03:10Z","merged_at":null,"merge_commit_sha":"fb081e8eeb4d37e47b5acdb310050fdb0b87ee5d","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/civicrm/civicrm-core/pulls/7613/commits","review_comments_url":"https://api.github.com/repos/civicrm/civicrm-core/pulls/7613/comments","review_comment_url":"https://api.github.com/repos/civicrm/civicrm-core/pulls/comments{/number}","comments_url":"https://api.github.com/repos/civicrm/civicrm-core/issues/7613/comments","statuses_url":"https://api.github.com/repos/civicrm/civicrm-core/statuses/3249008b8f115ab36f22428d33d01f985f6ded3d","head":{"label":"circleinteractive:master","ref":"master","sha":"3249008b8f115ab36f22428d33d01f985f6ded3d","user":{"login":"circleinteractive","id":3908183,"avatar_url":"https://avatars.githubusercontent.com/u/3908183?v=3","gravatar_id":"","url":"https://api.github.com/users/circleinteractive","html_url":"https://github.com/circleinteractive","followers_url":"https://api.github.com/users/circleinteractive/followers","following_url":"https://api.github.com/users/circleinteractive/following{/other_user}","gists_url":"https://api.github.com/users/circleinteractive/gists{/gist_id}","starred_url":"https://api.github.com/users/circleinteractive/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/circleinteractive/subscriptions","organizations_url":"https://api.github.com/users/circleinteractive/orgs","repos_url":"https://api.github.com/users/circleinteractive/repos","events_url":"https://api.github.com/users/circleinteractive/events{/privacy}","received_events_url":"https://api.github.com/users/circleinteractive/received_events","type":"User","site_admin":false},"repo":{"id":49944752,"name":"civicrm-core","full_name":"circleinteractive/civicrm-core","owner":{"login":"circleinteractive","id":3908183,"avatar_url":"https://avatars.githubusercontent.com/u/3908183?v=3","gravatar_id":"","url":"https://api.github.com/users/circleinteractive","html_url":"https://github.com/circleinteractive","followers_url":"https://api.github.com/users/circleinteractive/followers","following_url":"https://api.github.com/users/circleinteractive/following{/other_user}","gists_url":"https://api.github.com/users/circleinteractive/gists{/gist_id}","starred_url":"https://api.github.com/users/circleinteractive/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/circleinteractive/subscriptions","organizations_url":"https://api.github.com/users/circleinteractive/orgs","repos_url":"https://api.github.com/users/circleinteractive/repos","events_url":"https://api.github.com/users/circleinteractive/events{/privacy}","received_events_url":"https://api.github.com/users/circleinteractive/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/circleinteractive/civicrm-core","description":"CiviCRM (Core Application and Framework)","fork":true,"url":"https://api.github.com/repos/circleinteractive/civicrm-core","forks_url":"https://api.github.com/repos/circleinteractive/civicrm-core/forks","keys_url":"https://api.github.com/repos/circleinteractive/civicrm-core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/circleinteractive/civicrm-core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/circleinteractive/civicrm-core/teams","hooks_url":"https://api.github.com/repos/circleinteractive/civicrm-core/hooks","issue_events_url":"https://api.github.com/repos/circleinteractive/civicrm-core/issues/events{/number}","events_url":"https://api.github.com/repos/circleinteractive/civicrm-core/events","assignees_url":"https://api.github.com/repos/circleinteractive/civicrm-core/assignees{/user}","branches_url":"https://api.github.com/repos/circleinteractive/civicrm-core/branches{/branch}","tags_url":"https://api.github.com/repos/circleinteractive/civicrm-core/tags","blobs_url":"https://api.github.com/repos/circleinteractive/civicrm-core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/circleinteractive/civicrm-core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/circleinteractive/civicrm-core/git/refs{/sha}","trees_url":"https://api.github.com/repos/circleinteractive/civicrm-core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/circleinteractive/civicrm-core/statuses/{sha}","languages_url":"https://api.github.com/repos/circleinteractive/civicrm-core/languages","stargazers_url":"https://api.github.com/repos/circleinteractive/civicrm-core/stargazers","contributors_url":"https://api.github.com/repos/circleinteractive/civicrm-core/contributors","subscribers_url":"https://api.github.com/repos/circleinteractive/civicrm-core/subscribers","subscription_url":"https://api.github.com/repos/circleinteractive/civicrm-core/subscription","commits_url":"https://api.github.com/repos/circleinteractive/civicrm-core/commits{/sha}","git_commits_url":"https://api.github.com/repos/circleinteractive/civicrm-core/git/commits{/sha}","comments_url":"https://api.github.com/repos/circleinteractive/civicrm-core/comments{/number}","issue_comment_url":"https://api.github.com/repos/circleinteractive/civicrm-core/issues/comments{/number}","contents_url":"https://api.github.com/repos/circleinteractive/civicrm-core/contents/{+path}","compare_url":"https://api.github.com/repos/circleinteractive/civicrm-core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/circleinteractive/civicrm-core/merges","archive_url":"https://api.github.com/repos/circleinteractive/civicrm-core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/circleinteractive/civicrm-core/downloads","issues_url":"https://api.github.com/repos/circleinteractive/civicrm-core/issues{/number}","pulls_url":"https://api.github.com/repos/circleinteractive/civicrm-core/pulls{/number}","milestones_url":"https://api.github.com/repos/circleinteractive/civicrm-core/milestones{/number}","notifications_url":"https://api.github.com/repos/circleinteractive/civicrm-core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/circleinteractive/civicrm-core/labels{/name}","releases_url":"https://api.github.com/repos/circleinteractive/civicrm-core/releases{/id}","created_at":"2016-01-19T10:21:38Z","updated_at":"2016-01-19T10:21:52Z","pushed_at":"2016-01-19T10:35:33Z","git_url":"git://github.com/circleinteractive/civicrm-core.git","ssh_url":"git@github.com:circleinteractive/civicrm-core.git","clone_url":"https://github.com/circleinteractive/civicrm-core.git","svn_url":"https://github.com/circleinteractive/civicrm-core","homepage":null,"size":113983,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"civicrm:master","ref":"master","sha":"f8cb50f0c0c35efdbb632da3e3ea46a7902fbda3","user":{"login":"civicrm","id":136373,"avatar_url":"https://avatars.githubusercontent.com/u/136373?v=3","gravatar_id":"","url":"https://api.github.com/users/civicrm","html_url":"https://github.com/civicrm","followers_url":"https://api.github.com/users/civicrm/followers","following_url":"https://api.github.com/users/civicrm/following{/other_user}","gists_url":"https://api.github.com/users/civicrm/gists{/gist_id}","starred_url":"https://api.github.com/users/civicrm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/civicrm/subscriptions","organizations_url":"https://api.github.com/users/civicrm/orgs","repos_url":"https://api.github.com/users/civicrm/repos","events_url":"https://api.github.com/users/civicrm/events{/privacy}","received_events_url":"https://api.github.com/users/civicrm/received_events","type":"Organization","site_admin":false},"repo":{"id":8495499,"name":"civicrm-core","full_name":"civicrm/civicrm-core","owner":{"login":"civicrm","id":136373,"avatar_url":"https://avatars.githubusercontent.com/u/136373?v=3","gravatar_id":"","url":"https://api.github.com/users/civicrm","html_url":"https://github.com/civicrm","followers_url":"https://api.github.com/users/civicrm/followers","following_url":"https://api.github.com/users/civicrm/following{/other_user}","gists_url":"https://api.github.com/users/civicrm/gists{/gist_id}","starred_url":"https://api.github.com/users/civicrm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/civicrm/subscriptions","organizations_url":"https://api.github.com/users/civicrm/orgs","repos_url":"https://api.github.com/users/civicrm/repos","events_url":"https://api.github.com/users/civicrm/events{/privacy}","received_events_url":"https://api.github.com/users/civicrm/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/civicrm/civicrm-core","description":"CiviCRM (Core Application and Framework)","fork":false,"url":"https://api.github.com/repos/civicrm/civicrm-core","forks_url":"https://api.github.com/repos/civicrm/civicrm-core/forks","keys_url":"https://api.github.com/repos/civicrm/civicrm-core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/civicrm/civicrm-core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/civicrm/civicrm-core/teams","hooks_url":"https://api.github.com/repos/civicrm/civicrm-core/hooks","issue_events_url":"https://api.github.com/repos/civicrm/civicrm-core/issues/events{/number}","events_url":"https://api.github.com/repos/civicrm/civicrm-core/events","assignees_url":"https://api.github.com/repos/civicrm/civicrm-core/assignees{/user}","branches_url":"https://api.github.com/repos/civicrm/civicrm-core/branches{/branch}","tags_url":"https://api.github.com/repos/civicrm/civicrm-core/tags","blobs_url":"https://api.github.com/repos/civicrm/civicrm-core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/civicrm/civicrm-core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/civicrm/civicrm-core/git/refs{/sha}","trees_url":"https://api.github.com/repos/civicrm/civicrm-core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/civicrm/civicrm-core/statuses/{sha}","languages_url":"https://api.github.com/repos/civicrm/civicrm-core/languages","stargazers_url":"https://api.github.com/repos/civicrm/civicrm-core/stargazers","contributors_url":"https://api.github.com/repos/civicrm/civicrm-core/contributors","subscribers_url":"https://api.github.com/repos/civicrm/civicrm-core/subscribers","subscription_url":"https://api.github.com/repos/civicrm/civicrm-core/subscription","commits_url":"https://api.github.com/repos/civicrm/civicrm-core/commits{/sha}","git_commits_url":"https://api.github.com/repos/civicrm/civicrm-core/git/commits{/sha}","comments_url":"https://api.github.com/repos/civicrm/civicrm-core/comments{/number}","issue_comment_url":"https://api.github.com/repos/civicrm/civicrm-core/issues/comments{/number}","contents_url":"https://api.github.com/repos/civicrm/civicrm-core/contents/{+path}","compare_url":"https://api.github.com/repos/civicrm/civicrm-core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/civicrm/civicrm-core/merges","archive_url":"https://api.github.com/repos/civicrm/civicrm-core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/civicrm/civicrm-core/downloads","issues_url":"https://api.github.com/repos/civicrm/civicrm-core/issues{/number}","pulls_url":"https://api.github.com/repos/civicrm/civicrm-core/pulls{/number}","milestones_url":"https://api.github.com/repos/civicrm/civicrm-core/milestones{/number}","notifications_url":"https://api.github.com/repos/civicrm/civicrm-core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/civicrm/civicrm-core/labels{/name}","releases_url":"https://api.github.com/repos/civicrm/civicrm-core/releases{/id}","created_at":"2013-03-01T06:11:56Z","updated_at":"2016-01-21T01:03:29Z","pushed_at":"2016-01-21T22:01:53Z","git_url":"git://github.com/civicrm/civicrm-core.git","ssh_url":"git@github.com:civicrm/civicrm-core.git","clone_url":"https://github.com/civicrm/civicrm-core.git","svn_url":"https://github.com/civicrm/civicrm-core","homepage":null,"size":127488,"stargazers_count":139,"watchers_count":139,"language":"PHP","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":364,"mirror_url":null,"open_issues_count":59,"forks":364,"open_issues":59,"watchers":139,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/civicrm/civicrm-core/pulls/7613"},"html":{"href":"https://github.com/civicrm/civicrm-core/pull/7613"},"issue":{"href":"https://api.github.com/repos/civicrm/civicrm-core/issues/7613"},"comments":{"href":"https://api.github.com/repos/civicrm/civicrm-core/issues/7613/comments"},"review_comments":{"href":"https://api.github.com/repos/civicrm/civicrm-core/pulls/7613/comments"},"review_comment":{"href":"https://api.github.com/repos/civicrm/civicrm-core/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/civicrm/civicrm-core/pulls/7613/commits"},"statuses":{"href":"https://api.github.com/repos/civicrm/civicrm-core/statuses/3249008b8f115ab36f22428d33d01f985f6ded3d"}},"merged":false,"mergeable":true,"mergeable_state":"clean","merged_by":null,"comments":5,"review_comments":0,"commits":1,"additions":1,"deletions":1,"changed_files":1}}