WordPress.org

Forums

Slow MySql queries - causing problems for hoster (2 posts)

  1. AlexinMilan
    Member
    Posted 7 years ago #

    For the third time in under 30 days, Mediatemple has picked up a surge in database activity. Not knowing much about this, I thought it may have been down to getting more site visitors than usual, but although number are growing, I only get around 100 page views a day according to Google Analytics.

    So, I've just run a slow query analyser, and here are the results:

    Created 10:55 AM 01/08/2008
    ### 9 Queries
    ### Total time: 18, Average time: 2
    ### Taking 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 seconds to complete
    ### Rows analyzed 12454, 12454, 12454, 12454, 12454, 12454, 12454, 12454 and 12454
    SET timestamp=XXX;
    select ID, post_date, post_title, post_status, name
    from wp_posts, wp_terms, wp_term_relationships, wp_term_taxonomy
    where wp_posts.ID = wp_term_relationships.object_id
    and wp_term_relationships.term_taxonomy_id = wp_term_taxonomy.term_taxonomy_id
    and wp_term_taxonomy.term_id = wp_terms.term_id
    and post_status = 'XXX'
    and taxonomy = 'XXX'
    and post_date < NOW()
    order by name asc, post_title asc;
    SET timestamp=1199818410;
    select ID, post_date, post_title, post_status, name
    from wp_posts, wp_terms, wp_term_relationships, wp_term_taxonomy
    where wp_posts.ID = wp_term_relationships.object_id
    and wp_term_relationships.term_taxonomy_id = wp_term_taxonomy.term_taxonomy_id
    and wp_term_taxonomy.term_id = wp_terms.term_id
    and post_status = 'publish'
    and taxonomy = 'category'
    and post_date < NOW()
    order by name asc, post_title asc;
    ### 1 Query
    ### Total time: 2, Average time: 2
    ### Taking 2 seconds to complete
    ### Rows analyzed 12454
    use dbXXX_mywp;
    SET timestamp=XXX;
    select ID, post_date, post_title, post_status, name
    from wp_posts, wp_terms, wp_term_relationships, wp_term_taxonomy
    where wp_posts.ID = wp_term_relationships.object_id
    and wp_term_relationships.term_taxonomy_id = wp_term_taxonomy.term_taxonomy_id
    and wp_term_taxonomy.term_id = wp_terms.term_id
    and post_status = 'XXX'
    and taxonomy = 'XXX'
    and post_date < NOW()
    order by name asc, post_title asc;
    use db00000_mxxx;
    SET timestamp=1199818410;
    select ID, post_date, post_title, post_status, name
    from wp_posts, wp_terms, wp_term_relationships, wp_term_taxonomy
    where wp_posts.ID = wp_term_relationships.object_id
    and wp_term_relationships.term_taxonomy_id = wp_term_taxonomy.term_taxonomy_id
    and wp_term_taxonomy.term_id = wp_terms.term_id
    and post_status = 'publish'
    and taxonomy = 'category'
    and post_date < NOW()
    order by name asc, post_title asc;

    I don't know how to read them - can anyone tell me if I can understand which plugin may be causing problems?

    I'm using WP 2.3.2, PHP 5 (I have 2 WP sites on the server - so two databases - the other database was on PHP 4 - now changed to PHP 5)

    These are the plugins that are active:

    * Adsense-Deluxe
    * Akismet
    * Archives By Category
    * Articles
    * Contact Form 7
    * Democracy
    * Democracy Widget
    * Future Calendar
    * Google XML Sitemaps
    * Similar Posts
    * Simple Tags
    * Social Bookmarking RELOADED
    * Viper's Video Quicktags
    * wp-cache - not activated, was activated before recent WP Upgrade

    Any suggestions - before MediaTemple make me pay more?

    Thanks in advance,

    Alex

  2. AlexinMilan
    Member
    Posted 7 years ago #

    Found this in the ArchivesByCategoryV2.0.php plugin - which is now inactive. I think this is the source of the problem:

    select ID, post_date, post_title, post_status, name
    from {$table_prefix}posts, {$table_prefix}terms, {$table_prefix}term_relationships, {$table_prefix}term_taxonomy
    where {$table_prefix}posts.ID = {$table_prefix}term_relationships.object_id
    and {$table_prefix}term_relationships.term_taxonomy_id = {$table_prefix}term_taxonomy.term_taxonomy_id
    and {$table_prefix}term_taxonomy.term_id = {$table_prefix}terms.term_id
    and post_status = 'publish'
    and taxonomy = 'category'
    and post_date < NOW()
    order by name asc, post_title asc;

    Can someone confirm my interpretation? Thanks.

    Alex

Topic Closed

This topic has been closed to new replies.

About this Topic