{"action":"opened","issue":{"url":"https://api.github.com/repos/woothemes/woocommerce/issues/7228","labels_url":"https://api.github.com/repos/woothemes/woocommerce/issues/7228/labels{/name}","comments_url":"https://api.github.com/repos/woothemes/woocommerce/issues/7228/comments","events_url":"https://api.github.com/repos/woothemes/woocommerce/issues/7228/events","html_url":"https://github.com/woothemes/woocommerce/issues/7228","id":55724411,"number":7228,"title":"WC_Admin_Report::sales_sparkline() - Killing large site with 56,000 orders","user":{"login":"emmixaustralia","id":4131848,"avatar_url":"https://avatars.githubusercontent.com/u/4131848?v=3","gravatar_id":"","url":"https://api.github.com/users/emmixaustralia","html_url":"https://github.com/emmixaustralia","followers_url":"https://api.github.com/users/emmixaustralia/followers","following_url":"https://api.github.com/users/emmixaustralia/following{/other_user}","gists_url":"https://api.github.com/users/emmixaustralia/gists{/gist_id}","starred_url":"https://api.github.com/users/emmixaustralia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/emmixaustralia/subscriptions","organizations_url":"https://api.github.com/users/emmixaustralia/orgs","repos_url":"https://api.github.com/users/emmixaustralia/repos","events_url":"https://api.github.com/users/emmixaustralia/events{/privacy}","received_events_url":"https://api.github.com/users/emmixaustralia/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-01-28T07:46:22Z","updated_at":"2015-01-28T07:46:22Z","closed_at":null,"body":"This query SELECT SUM( meta__order_total.meta_value) as sparkline_value, posts.post_date as post_date FROM wp_p is killing our site on an hourly (approx) basis. \r\n\r\nCan the sparkline query be made more efficient (given the site has 56,000 orders)? Is there a patch for this query and a site with this many orders?\r\n\r\n------\r\n\r\nAs you can see in the logs below, after this query, every other query is locked. \r\n\r\n| 288731 | hidden | localhost | hidden _live | Query   | 9    | Copying to tmp table | SELECT SUM( meta__order_total.meta_value) as sparkline_value, posts.post_date as post_date FROM wp_p |\r\n\r\n| 288802 | hidden | localhost | hidden_live | Query   | 6    | Locked               | SELECT post_id, meta_key, meta_value FROM wp_postmeta WHERE post_id IN (250507,250937,252026,252695, |\r\n\r\n| 288817 | hidden | localhost | hidden_live | Query   | 6    | Locked               | SELECT post_id, meta_key, meta_value FROM wp_postmeta WHERE post_id IN (163859) ORDER BY meta_id ASC |\r\n\r\netc etc"}}