WordPress.org

Ready to get started?Download WordPress

Forums

The Events Calendar
Slow SQL queries and bad performance (2 posts)

  1. FolioVision
    Member
    Posted 1 year ago #

    Hello,

    we have around 100,000 items in posts table and 300,000 in postmeta. This plugin is using some multiple JOIN commands in SQL queries which are pretty slow when you have a lot of posts.

    The bigger issue is, that it changes every SQL query that is used in WP Query, when you are looking at the calendar page.

    Since we use a custom template for calendar display, I just removed all of these hooked plugin functions which adjust SQL using the following:

    remove_filter( 'parse_query', array( 'TribeEventsQuery', 'setupQuery'), 0 );
    remove_filter( 'parse_tribe_event_query', array( 'TribeEventsQuery', 'setupQueryArgs') );
    remove_filter( 'parse_tribe_event_query', array( 'TribeEventsQuery', 'setArgsFromDisplayType') );
    remove_filter( 'posts_join', array( 'TribeEventsQuery', 'setupJoins') );
    remove_filter( 'posts_where', array( 'TribeEventsQuery', 'addEventConditions') );
    remove_filter( 'posts_fields', array( 'TribeEventsQuery', 'setupFields') );
    remove_filter( 'posts_groupby', array( 'TribeEventsQuery', 'addStartDateToGroupBy') );
    remove_filter( 'posts_orderby', array( 'TribeEventsQuery', 'dateOrderBy') );

    That way the calendar works properly, but the sidebar widgets which use WP Query are not slowed down by the unnecessary JOINs.

    Thanks,
    Martin

    http://wordpress.org/extend/plugins/the-events-calendar/

  2. roblagatta
    Modern Tribe Support
    Plugin Author

    Posted 1 year ago #

    Nice! Thanks for sharing this, FolioVision. Hopefully this will be helpful to other users who experience this down the road.

    Regarding overall speed issues for the plugin...we are aware that on sites running a number of events, there is definitely slowdown. We've got a small patch that should improve overall speed (regardless of the # of events in the system) coming in 2.0.7 next month, and hopefully a broader resolution in the 2.1 build we're moving into from there. This is a known issue, though, and one we're working to fix.

    Let us know if we can do anything else or if you have any other questions.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic