{"id":1448615,"date":"2018-02-09T00:04:52","date_gmt":"2018-02-09T08:04:52","guid":{"rendered":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/events-calendar-with-tickets-very-slow-and-some-problems-with-sql\/"},"modified":"2018-02-09T00:04:52","modified_gmt":"2018-02-09T08:04:52","slug":"events-calendar-with-tickets-very-slow-and-some-problems-with-sql","status":"closed","type":"topic","link":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/events-calendar-with-tickets-very-slow-and-some-problems-with-sql\/","title":{"rendered":"Events calendar with tickets very slow and some problems with sql"},"content":{"rendered":"<p>Hi There,<\/p>\n<p>My test users are reporting that my calendar is way too slow. Of course i know myself too but anyways. I have been investigating it and found out the following problems in the sql queries. The problems described below my text. The calendar plugin and tickets plugin are also creating 372 duplicate queries in the calendar view i do not know is it possible to avoid these duplicate queries.<\/p>\n<p>So my question is that what can i do for making the calendar and its views faster. I am using month view with two events displayed, which is under the default.<\/p>\n<p>Thanks&#8230;<\/p>\n<p>I analyzed the page and got the following results<\/p>\n<p>This is analysed as slow query according sql analysis:<\/p>\n<p>SELECT tribe_event_start.post_id as ID, tribe_event_start.meta_value as EventStartDate, tribe_event_end_date.meta_value as EventEndDate<br \/>\nFROM wp_postmeta AS tribe_event_start<br \/>\nLEFT JOIN wp_posts<br \/>\nON tribe_event_start.post_id = wp_posts.ID<br \/>\nLEFT JOIN wp_postmeta as tribe_event_end_date<br \/>\nON ( tribe_event_start.post_id = tribe_event_end_date.post_id<br \/>\nAND tribe_event_end_date.meta_key = &#8216;_EventEndDate&#8217; )<br \/>\nWHERE wp_posts.ID NOT IN ( 2253,2252,2290,2285,2294,2291,2302,2824,2831,2825,2832,2839,2833,2846,2840,2847,2854,2848,2861,2855,2870,5260 )<br \/>\nAND tribe_event_start.meta_key = &#8216;_EventStartDate&#8217;<br \/>\nAND ( ( tribe_event_start.meta_value &gt;= &#8216;2018-05-28 00:00:00&#8217;<br \/>\nAND tribe_event_start.meta_value = &#8216;2018-05-28 00:00:00&#8217;<br \/>\nAND tribe_event_end_date.meta_value &lt;= &#039;2018-07-01 23:59:59&#039; )<br \/>\nOR ( tribe_event_start.meta_value  &#8216;2018-07-01 23:59:59&#8217; ) )<br \/>\nAND wp_posts.post_status IN(&#8216;publish&#8217;,&#8217;private&#8217;)<br \/>\nORDER BY wp_posts.menu_order ASC, DATE(tribe_event_start.meta_value) ASC, TIME(tribe_event_start.meta_value) ASC;<\/p>\n<hr \/>\n<p>This query has some errors on it:<br \/>\nUnknown column &#8216;wp_postmeta.meta_value&#8217; in &#8216;field list&#8217;<\/p>\n<p>SELECT DISTINCT wp_posts.*, MIN(wp_postmeta.meta_value) as EventStartDate, MIN(tribe_event_end_date.meta_value) as EventEndDate<br \/>\nFROM wp_posts<br \/>\nLEFT JOIN wp_term_relationships<br \/>\nON (wp_posts.ID = wp_term_relationships.object_id)<br \/>\nLEFT JOIN wp_postmeta as tribe_event_end_date<br \/>\nON ( wp_posts.ID = tribe_event_end_date.post_id<br \/>\nAND tribe_event_end_date.meta_key = &#8216;_EventEndDateUTC&#8217; )<br \/>\nWHERE 1=1<br \/>\nAND ( wp_term_relationships.term_taxonomy_id IN (79) )<br \/>\nAND wp_posts.post_type = &#8216;tribe_events&#8217;<br \/>\nAND (wp_posts.post_status = &#8216;publish&#8217;<br \/>\nOR wp_posts.post_status = &#8216;tribe-ea-success&#8217;<br \/>\nOR wp_posts.post_status = &#8216;tribe-ea-failed&#8217;<br \/>\nOR wp_posts.post_status = &#8216;tribe-ea-schedule&#8217;<br \/>\nOR wp_posts.post_status = &#8216;tribe-ea-pending&#8217;<br \/>\nOR wp_posts.post_status = &#8216;tribe-ea-draft&#8217;<br \/>\nOR wp_posts.post_status = &#8216;private&#8217;)<br \/>\nAND (wp_postmeta.meta_value &gt;= &#8216;2018-05-31 23:00:00&#8217;<br \/>\nOR (wp_postmeta.meta_value = &#8216;2018-05-31 23:00:00&#8217; ))<br \/>\nGROUP BY wp_posts.ID<br \/>\nORDER BY EventStartDate DESC, wp_posts.post_date DESC<br \/>\nLIMIT 0, 1<\/p>\n","protected":false},"template":"","class_list":["post-1448615","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>Events calendar with tickets very slow and some problems with sql -<\/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\/events-calendar-with-tickets-very-slow-and-some-problems-with-sql\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Events calendar with tickets very slow and some problems with sql -\" \/>\n<meta property=\"og:description\" content=\"Hi There, My test users are reporting that my calendar is way too slow. Of course i know myself too but anyways. I have been investigating it and found out the following problems in the sql queries. The problems described below my text. The calendar plugin and tickets plugin are also creating 372 duplicate queries [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/events-calendar-with-tickets-very-slow-and-some-problems-with-sql\/\" \/>\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=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/events-calendar-with-tickets-very-slow-and-some-problems-with-sql\/\",\"url\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/events-calendar-with-tickets-very-slow-and-some-problems-with-sql\/\",\"name\":\"Events calendar with tickets very slow and some problems with sql -\",\"isPartOf\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/#website\"},\"datePublished\":\"2018-02-09T08:04:52+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/events-calendar-with-tickets-very-slow-and-some-problems-with-sql\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/events-calendar-with-tickets-very-slow-and-some-problems-with-sql\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/events-calendar-with-tickets-very-slow-and-some-problems-with-sql\/#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\":\"Ticket Products\",\"item\":\"https:\/\/theeventscalendar.com\/support\/forums\/forum\/event-tickets\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Event Tickets Plus\",\"item\":\"https:\/\/theeventscalendar.com\/support\/forums\/forum\/event-tickets\/event-tickets-plus\/\"},{\"@type\":\"ListItem\",\"position\":5,\"name\":\"Events calendar with tickets very slow and some problems with sql\"}]},{\"@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":"Events calendar with tickets very slow and some problems with sql -","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\/events-calendar-with-tickets-very-slow-and-some-problems-with-sql\/","og_locale":"en_US","og_type":"article","og_title":"Events calendar with tickets very slow and some problems with sql -","og_description":"Hi There, My test users are reporting that my calendar is way too slow. Of course i know myself too but anyways. I have been investigating it and found out the following problems in the sql queries. The problems described below my text. The calendar plugin and tickets plugin are also creating 372 duplicate queries [&hellip;]","og_url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/events-calendar-with-tickets-very-slow-and-some-problems-with-sql\/","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/events-calendar-with-tickets-very-slow-and-some-problems-with-sql\/","url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/events-calendar-with-tickets-very-slow-and-some-problems-with-sql\/","name":"Events calendar with tickets very slow and some problems with sql -","isPartOf":{"@id":"https:\/\/theeventscalendar.com\/support\/#website"},"datePublished":"2018-02-09T08:04:52+00:00","breadcrumb":{"@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/events-calendar-with-tickets-very-slow-and-some-problems-with-sql\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/theeventscalendar.com\/support\/forums\/topic\/events-calendar-with-tickets-very-slow-and-some-problems-with-sql\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/events-calendar-with-tickets-very-slow-and-some-problems-with-sql\/#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":"Ticket Products","item":"https:\/\/theeventscalendar.com\/support\/forums\/forum\/event-tickets\/"},{"@type":"ListItem","position":4,"name":"Event Tickets Plus","item":"https:\/\/theeventscalendar.com\/support\/forums\/forum\/event-tickets\/event-tickets-plus\/"},{"@type":"ListItem","position":5,"name":"Events calendar with tickets very slow and some problems with sql"}]},{"@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\/1448615","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\/1448615\/revisions"}],"wp:attachment":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/media?parent=1448615"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}