{"id":1391987,"date":"2017-11-26T14:39:30","date_gmt":"2017-11-26T22:39:30","guid":{"rendered":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/mysql-performance-issues\/"},"modified":"2017-11-26T14:39:30","modified_gmt":"2017-11-26T22:39:30","slug":"mysql-performance-issues","status":"closed","type":"topic","link":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/mysql-performance-issues\/","title":{"rendered":"Mysql performance issues"},"content":{"rendered":"<p>I&#8217;m experiencing ongoing high CPU usage on my server from mysql.  I&#8217;ve been reviewing slow queries log, and nearly all of the slow queries are coming from posts like below, with Query times 30+!  The query looks to be a 3-table select.<\/p>\n<p>below is one of the queries from my log:<\/p>\n<p>How can this be fixed?<\/p>\n<p> [0] =&gt; # User@Host: irookcom_wrdp2[irookcom_wrdp2] @ localhost []  Id: 57627<\/p>\n<p>    [1] =&gt; # Query_time: 33.846053  Lock_time: 0.000169 Rows_sent: 141  Rows_examined: 108549<\/p>\n<p>    [2] =&gt; SET timestamp=1511580830;<\/p>\n<p>    [3] =&gt; SELECT tribe_event_start.post_id as ID,<\/p>\n<p>    [4] =&gt; \t\t\t\t\t\t\ttribe_event_start.meta_value as EventStartDate,<\/p>\n<p>    [5] =&gt; \t\t\t\t\t\t\ttribe_event_end_date.meta_value as EventEndDate<\/p>\n<p>    [6] =&gt; \t\t\t\t\tFROM wp_postmeta AS tribe_event_start<\/p>\n<p>    [7] =&gt; \t\t\t\t\tLEFT JOIN wp_posts ON tribe_event_start.post_id = wp_posts.ID<\/p>\n<p>    [8] =&gt; \t\t\t\t\tLEFT JOIN wp_postmeta as tribe_event_end_date ON ( tribe_event_start.post_id = tribe_event_end_date.post_id AND tribe_event_end_date.meta_key = &#8216;_EventEndDate&#8217; )<\/p>\n<p>    [9] =&gt; \t\t\t\t\tWHERE  tribe_event_start.meta_key = &#8216;_EventStartDate&#8217;<\/p>\n<p>    [10] =&gt; \t\t\t\t\tAND (<\/p>\n<p>    [11] =&gt; \t\t\t\t\t\t(<\/p>\n<p>    [12] =&gt; \t\t\t\t\t\t\ttribe_event_start.meta_value &gt;= &#8216;2017-10-29 02:00:00&#8217;<\/p>\n<p>    [13] =&gt; \t\t\t\t\t\t\tAND tribe_event_start.meta_value &lt;= &#8216;2017-12-03 01:59:59&#8217;<\/p>\n<p>    [14] =&gt; \t\t\t\t\t\t)<\/p>\n<p>    [15] =&gt; \t\t\t\t\t\tOR (<\/p>\n<p>    [16] =&gt; \t\t\t\t\t\t\ttribe_event_end_date.meta_value &gt;= &#8216;2017-10-29 02:00:00&#8217;<\/p>\n<p>    [17] =&gt; \t\t\t\t\t\t\tAND tribe_event_end_date.meta_value &lt;= &#8216;2017-12-03 01:59:59&#8217;<\/p>\n<p>    [18] =&gt; \t\t\t\t\t\t)<\/p>\n<p>    [19] =&gt; \t\t\t\t\t\tOR (<\/p>\n<p>    [20] =&gt; \t\t\t\t\t\t\ttribe_event_start.meta_value &lt; &#8216;2017-10-29 02:00:00&#8217;<\/p>\n<p>    [21] =&gt; \t\t\t\t\t\t\tAND tribe_event_end_date.meta_value &gt; &#8216;2017-12-03 01:59:59&#8217;<\/p>\n<p>    [22] =&gt; \t\t\t\t\t\t)<\/p>\n<p>    [23] =&gt; \t\t\t\t\t)<\/p>\n<p>    [24] =&gt; \t\t\t\t\tAND wp_posts.post_status IN(&#8216;publish&#8217;)<\/p>\n<p>    [25] =&gt; \t\t\t\t\tORDER BY wp_posts.menu_order ASC, DATE(tribe_event_start.meta_value) ASC, TIME(tribe_event_start.meta_value) ASC;<\/p>\n","protected":false},"template":"","class_list":["post-1391987","topic","type-topic","status-closed","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Mysql performance issues -<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/mysql-performance-issues\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Mysql performance issues -\" \/>\n<meta property=\"og:description\" content=\"I&#8217;m experiencing ongoing high CPU usage on my server from mysql. I&#8217;ve been reviewing slow queries log, and nearly all of the slow queries are coming from posts like below, with Query times 30+! The query looks to be a 3-table select. below is one of the queries from my log: How can this be [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/mysql-performance-issues\/\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/mysql-performance-issues\/\",\"url\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/mysql-performance-issues\/\",\"name\":\"Mysql performance issues -\",\"isPartOf\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/#website\"},\"datePublished\":\"2017-11-26T22:39:30+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/mysql-performance-issues\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/mysql-performance-issues\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/mysql-performance-issues\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/theeventscalendar.com\/support\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Topics\",\"item\":\"https:\/\/theeventscalendar.com\/support\/topics\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Calendar Products\",\"item\":\"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Events Calendar PRO\",\"item\":\"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/events-calendar-pro\/\"},{\"@type\":\"ListItem\",\"position\":5,\"name\":\"Mysql performance issues\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/#website\",\"url\":\"https:\/\/theeventscalendar.com\/support\/\",\"name\":\"\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/theeventscalendar.com\/support\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Mysql performance issues -","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/mysql-performance-issues\/","og_locale":"en_US","og_type":"article","og_title":"Mysql performance issues -","og_description":"I&#8217;m experiencing ongoing high CPU usage on my server from mysql. I&#8217;ve been reviewing slow queries log, and nearly all of the slow queries are coming from posts like below, with Query times 30+! The query looks to be a 3-table select. below is one of the queries from my log: How can this be [&hellip;]","og_url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/mysql-performance-issues\/","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/mysql-performance-issues\/","url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/mysql-performance-issues\/","name":"Mysql performance issues -","isPartOf":{"@id":"https:\/\/theeventscalendar.com\/support\/#website"},"datePublished":"2017-11-26T22:39:30+00:00","breadcrumb":{"@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/mysql-performance-issues\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/theeventscalendar.com\/support\/forums\/topic\/mysql-performance-issues\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/mysql-performance-issues\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/theeventscalendar.com\/support\/"},{"@type":"ListItem","position":2,"name":"Topics","item":"https:\/\/theeventscalendar.com\/support\/topics\/"},{"@type":"ListItem","position":3,"name":"Calendar Products","item":"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/"},{"@type":"ListItem","position":4,"name":"Events Calendar PRO","item":"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/events-calendar-pro\/"},{"@type":"ListItem","position":5,"name":"Mysql performance issues"}]},{"@type":"WebSite","@id":"https:\/\/theeventscalendar.com\/support\/#website","url":"https:\/\/theeventscalendar.com\/support\/","name":"","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/theeventscalendar.com\/support\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic\/1391987","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic\/1391987\/revisions"}],"wp:attachment":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/media?parent=1391987"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}