Title: Slow Query Problem
Last modified: August 22, 2016

---

# Slow Query Problem

 *  Resolved [pgowder](https://wordpress.org/support/users/pgowder/)
 * (@pgowder)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/slow-query-problem/)
 * I’m getting lots of server errors. I’ve looked at the error logs and it appears
   that there are many queries that are slow and causing timeouts.
 * How can I fix?
 * Here are some examples:
    `Slow mysql_query() call was running query:\n\r\n\t\
   t\tSELECT SQL_CALC_FOUND_ROWS * FROM wp_em_events\r\n\t\t\tLEFT JOIN wp_em_locations
   ON wp_em_locations.location_id=wp_em_events.location_id\r\n\t\t\t WHERE (`recurrence`!
   =1 OR`recurrence`IS NULL) AND (`event_status`=1) AND (`event_private`=0)\r\n\
   t\t\tGROUP BY wp_em_events.post_id ORDER BY event_start_date DESC, event_start_time
   DESC, event_name DESC\r\n\t\t\tLIMIT 1 OFFSET 0\r\n\t\t /*`
 * =====
 * Stopwatch php.pod-1707.function.mysql_query.duration exceeded 1000ms. Was: 4289ms.\
   n#0 wpe\\measure\\LoggingStopwatch->logStackTrace(4289) called at [/nas/wp/www/
   common/production/measure.php:198]\n#1 wpe\\measure\\LoggingStopwatch->lap_ended(
   4289) called at [/nas/wp/www/common/production/measure.php:134]\n#2 wpe\\measure\\
   Stopwatch->lapstart() called at [/nas/wp/www/common/production/measure.php:152]\
   n#3 wpe\\measure\\Stopwatch->stop() called at [/nas/wp/www/common/production/
   statsd_monitoring.php(256) : runkit created function:19]\n#4 mysql_query(\r\n\
   t\t\tSELECT SQL_CALC_FOUND_ROWS * FROM wp_em_events\r\n\t\t\tLEFT JOIN wp_em_locations
   ON wp_em_locations.location_id=wp_em_events.location_id\r\n\t\t\t WHERE (`recurrence`!
   =1 OR `recurrence` IS NULL) AND (`event_status`=1) AND (`event_private`=0)\r\
   n\t\t\tGROUP BY wp_em_events.post_id ORDER BY event_start_date DESC, event_start_time
   DESC, event_name DESC\r\n\t\t\tLIMIT 1 OFFSET 0\r\n\t\t /* From [calendar.powwows.
   com/events-2/] in [/nas/wp/www/cluster-1707/pwcalendar/wp-content/plugins/events-
   manager/classes/em-events.php:90] */, Resource id #31) called at [/nas/wp/www/
   cluster-1707/pwcalendar/wp-includes/wp-db.php:1663]\n#5 wpdb->_do_query(\r\n\
   t\t\tSELECT SQL_CALC_FOUND_ROWS * FROM wp_em_events\r\n\t\t\tLEFT JOIN wp_em_locations
   ON wp_em_locations.location_id=wp_em_events.location_id\r\n\t\t\t WHERE (`recurrence`!
   =1 OR `recurrence` IS NULL) AND (`event_status`=1) AND (`event_private`=0)\r\
   n\t\t\tGROUP BY wp_em_events.post_id ORDER BY event_start_date DESC, event_start_time
   DESC, event_name DESC\r\n\t\t\tLIMIT 1 OFFSET 0\r\n\t\t /* From [calendar.powwows.
   com/events-2/] in [/nas/wp/www/cluster-1707/pwcalendar/wp-content/plugins/events-
   manager/classes/em-events.php:90] */) called at [/nas/wp/www/cluster-1707/pwcalendar/
   wp-includes/wp-db.php:1567]\n#6 wpdb->query(\r\n\t\t\tSELECT SQL_CALC_FOUND_ROWS*
   FROM wp_em_events\r\n\t\t\tLEFT JOIN wp_em_locations ON wp_em_locations.location_id
   =wp_em_events.location_id\r\n\t\t\t WHERE (`recurrence`!=1 OR `recurrence` IS
   NULL) AND (`event_status`=1) AND (`event_private`=0)\r\n\t\t\tGROUP BY wp_em_events.
   post_id ORDER BY event_start_date DESC, event_start_time DESC, event_name DESC\
   r\n\t\t\tLIMIT 1 OFFSET 0\r\n\t\t) called at [/nas/wp/www/cluster-1707/pwcalendar/
   wp-content/plugins/events-manager/classes/em-events.php:90]\n#7 EM_Events::get(
   Array ([limit] => ,[scope] => all,[order] => DESC,[orderby] => Array ([0] => 
   event_start_date,[1] => event_start_time,[2] => event_name),[format] => ,[category]
   => 0,[tag] => 0,[location] => ,[event] => ,[offset] => ,[page] => ,[recurrence]
   => 0,[recurrences] => ,[recurring] => ,[month] => ,[year] => ,[pagination] =>
   1,[array] => ,[owner] => ,[rsvp] => ,[bookings] => ,[search] => ,[geo] => ,[near]
   => ,[near_unit] => mi,[near_distance] => 25,[ajax] => ,[status] => 1,[format_header]
   => ,[format_footer] => ,[town] => ,[state] => ,[country] => ,[region] => ,[blog]
   => 1,[private] => ,[private_only] => ,[post_id] => ), 1) called at [/nas/wp/www/
   cluster-1707/pwcalendar/wp-content/plugins/events-manager/classes/em-events.php:
   130]\n#8 EM_Events::count(Array ([limit] => ,[scope] => all,[order] => DESC,[
   orderby] => Array ([0] => event_start_date,[1] => event_start_time,[2] => event_name),[
   format] => ,[category] => 0,[tag] => 0,[location] => ,[event] => ,[offset] =>,[
   page] => ,[recurrence] => 0,[recurrences] => ,[recurring] => ,[month] => ,[year]
   => ,[pagination] => 1,[array] => ,[owner] => ,[rsvp] => ,[bookings] => ,[search]
   => ,[geo] => ,[near] => ,[near_unit] => mi,[near_distance] => 25,[ajax] => ,[
   status] => 1,[format_header] => ,[format_footer] => ,[town] => ,[state] => ,[
   country] => ,[region] => ,[blog] => 1,[private] => ,[private_only] => ,[post_id]
   => )) called at [/nas/wp/www/cluster-1707/pwcalendar/wp-content/plugins/events-
   manager/classes/em-events.php:190]\n#9 EM_Events::output(Array ([owner] => ,[
   pagination] => 1,[ajax] => ,[orderby] => event_start_date,event_start_time,event_name,[
   order] => DESC,[scope] => all,[limit] => 20,[page] => 1)) called at [/nas/wp/
   www/cluster-1707/pwcalendar/wp-content/themes/Calendar 2014/plugins/events-manager/
   templates/events-list.php:43]\n#10 include(/nas/wp/www/cluster-1707/pwcalendar/
   wp-content/themes/Calendar 2014/plugins/events-manager/templates/events-list.
   php) called at [/nas/wp/www/cluster-1707/pwcalendar/wp-content/plugins/events-
   manager/events-manager.php:642]\n#11 em_locate_template(templates/events-list.
   php, 1, Array ([args] => Array ([owner] => ,[pagination] => 1,[ajax] => ,[orderby]
   => event_start_date,event_start_time,event_name,[order] => DESC,[scope] => all,[
   limit] => 20))) called at [/nas/wp/www/cluster-1707/pwcalendar/wp-content/plugins/
   events-manager/em-events.php:64]\n#12 em_content()\n#13 call_user_func_array(
   em_content, Array ([0] => )) called at [/nas/wp/www/cluster-1707/pwcalendar/wp-
   includes/plugin.php:213]\n#14 apply_filters(the_content, ) called at [/nas/wp/
   www/cluster-1707/pwcalendar/wp-includes/post-template.php:221]\n#15 the_content(
   <p>Read the rest of this page »</p>) called at [/nas/wp/www/cluster-1707/pwcalendar/
   wp-content/themes/Calendar 2014/page_r.php:170]\n#16 include(/nas/wp/www/cluster-
   1707/pwcalendar/wp-content/themes/Calendar 2014/page_r.php) called at [/nas/wp/
   www/cluster-1707/pwcalendar/wp-includes/template-loader.php:74]\n#17 require_once(/
   nas/wp/www/cluster-1707/pwcalendar/wp-includes/template-loader.php) called at[/
   nas/wp/www/cluster-1707/pwcalendar/wp-blog-header.php:16]\n#18 require(/nas/wp/
   www/cluster-1707/pwcalendar/wp-blog-header.php) called at [/nas/wp/www/cluster-
   1707/pwcalendar/index.php:17]\n
 * [https://wordpress.org/plugins/events-manager/](https://wordpress.org/plugins/events-manager/)

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Plugin Support [angelo_nwl](https://wordpress.org/support/users/angelo_nwl/)
 * (@angelo_nwl)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/slow-query-problem/#post-5839900)
 * just to narrow down the problem and help us debug the issue is it possible to
   try the following temporarily:
 * – deactivating all other plugins to see if this resolves the problem. If this
   works, re-activate the plugins one by one until you find the problematic plugin(
   s).
    – switching to the default theme to rule out any theme-specific problems
 *  Thread Starter [pgowder](https://wordpress.org/support/users/pgowder/)
 * (@pgowder)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/slow-query-problem/#post-5839919)
 * Thanks for the reply.
 * We have disabled all the plugins and checked. The problem continues.
 * I’ll paste in the latest errors below. I’ve disabled WPTouch, and left it off.
 * There were some errors with joins to WPTouch. Now the errors all appear to just
   be in the calendar plugin.
 * [Tue Mar 03 13:39:04 2015] [error] [client 82.32.136.199] [WPE Monitoring] Slow
   mysql_query() call was running query:\n\r\n\t\t\tSELECT SQL_CALC_FOUND_ROWS *
   FROM wp_em_events\r\n\t\t\tLEFT JOIN wp_em_locations ON wp_em_locations.location_id
   =wp_em_events.location_id\r\n\t\t\t WHERE (`recurrence`!=1 OR `recurrence` IS
   NULL) AND (`event_status`=1) AND (`event_private`=0)\r\n\t\t\tGROUP BY wp_em_events.
   post_id ORDER BY event_start_date DESC, event_start_time DESC, event_name DESC\
   r\n\t\t\tLIMIT 1 OFFSET 0\r\n\t\t /* From [calendar.powwows.com/events-2/] in[/
   nas/wp/www/cluster-1707/pwcalendar/wp-content/plugins/events-manager/classes/
   em-events.php:90] */, referer: [https://www.google.com/](https://www.google.com/)
   [
   Tue Mar 03 13:39:06 2015] [error] [client 82.32.136.199] [WPE Monitoring] Stopwatch
   php.pod-1707.function.mysql_query.duration exceeded 1000ms. Was: 1192ms.\n#0 
   wpe\\measure\\LoggingStopwatch->logStackTrace(1192) called at [/nas/wp/www/common/
   production/measure.php:198]\n#1 wpe\\measure\\LoggingStopwatch->lap_ended(1192)
   called at [/nas/wp/www/common/production/measure.php:134]\n#2 wpe\\measure\\Stopwatch-
   >lapstart() called at [/nas/wp/www/common/production/measure.php:152]\n#3 wpe\\
   measure\\Stopwatch->stop() called at [/nas/wp/www/common/production/statsd_monitoring.
   php(256) : runkit created function:19]\n#4 mysql_query(\r\n\t\t\tSELECT SQL_CALC_FOUND_ROWS*
   FROM wp_em_events\r\n\t\t\tLEFT JOIN wp_em_locations ON wp_em_locations.location_id
   =wp_em_events.location_id\r\n\t\t\t WHERE (`recurrence`!=1 OR `recurrence` IS
   NULL) AND (`event_status`=1) AND (`event_private`=0)\r\n\t\t\tGROUP BY wp_em_events.
   post_id ORDER BY event_start_date DESC, event_start_time DESC, event_name DESC\
   r\n\t\t\tLIMIT 1 OFFSET 0\r\n\t\t /* From [calendar.powwows.com/events-2/] in[/
   nas/wp/www/cluster-1707/pwcalendar/wp-content/plugins/events-manager/classes/
   em-events.php:90] */, Resource id #31) called at [/nas/wp/www/cluster-1707/pwcalendar/
   wp-includes/wp-db.php:1663]\n#5 wpdb->_do_query(\r\n\t\t\tSELECT SQL_CALC_FOUND_ROWS*
   FROM wp_em_events\r\n\t\t\tLEFT JOIN wp_em_locations ON wp_em_locations.location_id
   =wp_em_events.location_id\r\n\t\t\t WHERE (`recurrence`!=1 OR `recurrence` IS
   NULL) AND (`event_status`=1) AND (`event_private`=0)\r\n\t\t\tGROUP BY wp_em_events.
   post_id ORDER BY event_start_date DESC, event_start_time DESC, event_name DESC\
   r\n\t\t\tLIMIT 1 OFFSET 0\r\n\t\t /* From [calendar.powwows.com/events-2/] in[/
   nas/wp/www/cluster-1707/pwcalendar/wp-content/plugins/events-manager/classes/
   em-events.php:90] */) called at [/nas/wp/www/cluster-1707/pwcalendar/wp-includes/
   wp-db.php:1567]\n#6 wpdb->query(\r\n\t\t\tSELECT SQL_CALC_FOUND_ROWS * FROM wp_em_events\
   r\n\t\t\tLEFT JOIN wp_em_locations ON wp_em_locations.location_id=wp_em_events.
   location_id\r\n\t\t\t WHERE (`recurrence`!=1 OR `recurrence` IS NULL) AND (`event_status`
   =1) AND (`event_private`=0)\r\n\t\t\tGROUP BY wp_em_events.post_id ORDER BY event_start_date
   DESC, event_start_time DESC, event_name DESC\r\n\t\t\tLIMIT 1 OFFSET 0\r\n\t\
   t) called at [/nas/wp/www/cluster-1707/pwcalendar/wp-content/plugins/events-manager/
   classes/em-events.php:90]\n#7 EM_Events::get(Array ([limit] => ,[scope] => all,[
   order] => DESC,[orderby] => Array ([0] => event_start_date,[1] => event_start_time,[
   2] => event_name),[format] => ,[category] => 0,[tag] => 0,[location] => ,[event]
   => ,[offset] => ,[page] => ,[recurrence] => 0,[recurrences] => ,[recurring] =
   > ,[month] => ,[year] => ,[pagination] => 1,[array] => ,[owner] => ,[rsvp] =>,[
   bookings] => ,[search] => ,[geo] => ,[near] => ,[near_unit] => mi,[near_distance]
   => 25,[ajax] => ,[status] => 1,[format_header] => ,[format_footer] => ,[town]
   => ,[state] => ,[country] => ,[region] => ,[blog] => 1,[private] => ,[private_only]
   => ,[post_id] => ), 1) called at [/nas/wp/www/cluster-1707/pwcalendar/wp-content/
   plugins/events-manager/classes/em-events.php:130]\n#8 EM_Events::count(Array ([
   limit] => ,[scope] => all,[order] => DESC,[orderby] => Array ([0] => event_start_date,[
   1] => event_start_time,[2] => event_name),[format] => ,[category] => 0,[tag] 
   => 0,[location] => ,[event] => ,[offset] => ,[page] => ,[recurrence] => 0,[recurrences]
   => ,[recurring] => ,[month] => ,[year] => ,[pagination] => 1,[array] => ,[owner]
   => ,[rsvp] => ,[bookings] => ,[search] => ,[geo] => ,[near] => ,[near_unit] =
   > mi,[near_distance] => 25,[ajax] => ,[status] => 1,[format_header] => ,[format_footer]
   => ,[town] => ,[state] => ,[country] => ,[region] => ,[blog] => 1,[private] =
   > ,[private_only] => ,[post_id] => )) called at [/nas/wp/www/cluster-1707/pwcalendar/
   wp-content/plugins/events-manager/classes/em-events.php:190]\n#9 EM_Events::output(
   Array ([owner] => ,[pagination] => 1,[ajax] => ,[orderby] => event_start_date,
   event_start_time,event_name,[order] => DESC,[scope] => all,[limit] => 20,[page]
   => 1)) called at [/nas/wp/www/cluster-1707/pwcalendar/wp-content/themes/Calendar
   2014/plugins/events-manager/templates/events-list.php:43]\n#10 include(/nas/wp/
   www/cluster-1707/pwcalendar/wp-content/themes/Calendar 2014/plugins/events-manager/
   templates/events-list.php) called at [/nas/wp/www/cluster-1707/pwcalendar/wp-
   content/plugins/events-manager/events-manager.php:642]\n#11 em_locate_template(
   templates/events-list.php, 1, Array ([args] => Array ([owner] => ,[pagination]
   => 1,[ajax] => ,[orderby] => event_start_date,event_start_time,event_name,[order]
   => DESC,[scope] => all,[limit] => 20))) called at [/nas/wp/www/cluster-1707/pwcalendar/
   wp-content/plugins/events-manager/em-events.php:64]\n#12 em_content()\n#13 call_user_func_array(
   em_content, Array ([0] => )) called at [/nas/wp/www/cluster-1707/pwcalendar/wp-
   includes/plugin.php:213]\n#14 apply_filters(the_content, ) called at [/nas/wp/
   www/cluster-1707/pwcalendar/wp-includes/post-template.php:221]\n#15 the_content(
   <p>Read the rest of this page »</p>) called at [/nas/wp/www/cluster-1707/pwcalendar/
   wp-content/themes/Calendar 2014/page_r.php:170]\n#16 include(/nas/wp/www/cluster-
   1707/pwcalendar/wp-content/themes/Calendar 2014/page_r.php) called at [/nas/wp/
   www/cluster-1707/pwcalendar/wp-includes/template-loader.php:74]\n#17 require_once(/
   nas/wp/www/cluster-1707/pwcalendar/wp-includes/template-loader.php) called at[/
   nas/wp/www/cluster-1707/pwcalendar/wp-blog-header.php:16]\n#18 require(/nas/wp/
   www/cluster-1707/pwcalendar/wp-blog-header.php) called at [/nas/wp/www/cluster-
   1707/pwcalendar/index.php:17]\n, referer: [https://www.google.com/](https://www.google.com/)[
   Tue Mar 03 13:39:06 2015] [error] [client 82.32.136.199] [WPE Monitoring] Slow
   mysql_query() call was running query:\n\r\n\t\t\tSELECT SQL_CALC_FOUND_ROWS *
   FROM wp_em_events\r\n\t\t\tLEFT JOIN wp_em_locations ON wp_em_locations.location_id
   =wp_em_events.location_id\r\n\t\t\t WHERE (`recurrence`!=1 OR `recurrence` IS
   NULL) AND (`event_status`=1) AND (`event_private`=0)\r\n\t\t\tGROUP BY wp_em_events.
   post_id ORDER BY event_start_date DESC, event_start_time DESC, event_name DESC\
   r\n\t\t\tLIMIT 1 OFFSET 0\r\n\t\t /* From [calendar.powwows.com/events-2/] in[/
   nas/wp/www/cluster-1707/pwcalendar/wp-content/plugins/events-manager/classes/
   em-events.php:90] */, referer: [https://www.google.com/](https://www.google.com/)
 *  [caimin_nwl](https://wordpress.org/support/users/caimin_nwl/)
 * (@caimin_nwl)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/slow-query-problem/#post-5839944)
 * Which version of Events Manager and WordPress are you using?
 *  Thread Starter [pgowder](https://wordpress.org/support/users/pgowder/)
 * (@pgowder)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/slow-query-problem/#post-5839973)
 * Version 5.5.3
 *  [caimin_nwl](https://wordpress.org/support/users/caimin_nwl/)
 * (@caimin_nwl)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/slow-query-problem/#post-5839974)
 * Can you upgrade to the latest version?

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Slow Query Problem’ is closed to new replies.

 * ![](https://ps.w.org/events-manager/assets/icon-256x256.png?rev=1039078)
 * [Events Manager - Calendar, Bookings, Tickets, and more!](https://wordpress.org/plugins/events-manager/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/events-manager/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/events-manager/)
 * [Active Topics](https://wordpress.org/support/plugin/events-manager/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/events-manager/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/events-manager/reviews/)

 * 5 replies
 * 3 participants
 * Last reply from: [caimin_nwl](https://wordpress.org/support/users/caimin_nwl/)
 * Last activity: [11 years, 2 months ago](https://wordpress.org/support/topic/slow-query-problem/#post-5839974)
 * Status: resolved