{"action":"closed","issue":{"url":"https://api.github.com/repos/woothemes/woocommerce/issues/7322","labels_url":"https://api.github.com/repos/woothemes/woocommerce/issues/7322/labels{/name}","comments_url":"https://api.github.com/repos/woothemes/woocommerce/issues/7322/comments","events_url":"https://api.github.com/repos/woothemes/woocommerce/issues/7322/events","html_url":"https://github.com/woothemes/woocommerce/issues/7322","id":56848626,"number":7322,"title":"wc_customer_bought_product sql query is a Performance Nightmare","user":{"login":"30suns","id":9216706,"avatar_url":"https://avatars.githubusercontent.com/u/9216706?v=3","gravatar_id":"","url":"https://api.github.com/users/30suns","html_url":"https://github.com/30suns","followers_url":"https://api.github.com/users/30suns/followers","following_url":"https://api.github.com/users/30suns/following{/other_user}","gists_url":"https://api.github.com/users/30suns/gists{/gist_id}","starred_url":"https://api.github.com/users/30suns/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/30suns/subscriptions","organizations_url":"https://api.github.com/users/30suns/orgs","repos_url":"https://api.github.com/users/30suns/repos","events_url":"https://api.github.com/users/30suns/events{/privacy}","received_events_url":"https://api.github.com/users/30suns/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/woothemes/woocommerce/labels/Needs%20Unit%20Tests","name":"Needs Unit Tests","color":"444444"},{"url":"https://api.github.com/repos/woothemes/woocommerce/labels/Refactor","name":"Refactor","color":"d54d21"}],"state":"closed","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/woothemes/woocommerce/milestones/37","html_url":"https://github.com/woothemes/woocommerce/milestones/2.4%20(name%20undecided)","labels_url":"https://api.github.com/repos/woothemes/woocommerce/milestones/37/labels","id":865016,"number":37,"title":"2.4 (name undecided)","description":"","creator":{"login":"mikejolley","id":90977,"avatar_url":"https://avatars.githubusercontent.com/u/90977?v=3","gravatar_id":"","url":"https://api.github.com/users/mikejolley","html_url":"https://github.com/mikejolley","followers_url":"https://api.github.com/users/mikejolley/followers","following_url":"https://api.github.com/users/mikejolley/following{/other_user}","gists_url":"https://api.github.com/users/mikejolley/gists{/gist_id}","starred_url":"https://api.github.com/users/mikejolley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikejolley/subscriptions","organizations_url":"https://api.github.com/users/mikejolley/orgs","repos_url":"https://api.github.com/users/mikejolley/repos","events_url":"https://api.github.com/users/mikejolley/events{/privacy}","received_events_url":"https://api.github.com/users/mikejolley/received_events","type":"User","site_admin":false},"open_issues":20,"closed_issues":28,"state":"open","created_at":"2014-11-13T14:35:46Z","updated_at":"2015-03-27T13:18:02Z","due_on":null,"closed_at":null},"comments":1,"created_at":"2015-02-06T18:27:59Z","updated_at":"2015-03-27T13:18:02Z","closed_at":"2015-03-27T13:18:02Z","body":"The query in `includes/wc-user-functions.php ` `wc_customer_bought_product` is a performance nightmare on the single product page when a reasonable number of orders exist. I've profiled it eating up 2-3 seconds in the database on a single product that has say, several hundred orders. I haven't investigated whether it can be optimized, or mysql indexes added to fix it, I've just added a custom line  to `return false;` before the query runs, but it would be nice if it could be fixed properly in mainline."}}