Forums

Slow query slowing down the site tremendeously (5 posts)

  1. ag211
    Member
    Posted 2 years ago #

    I run a relatively large scale website of over 11,000 posts and over 100,000 comments and have been having problems as the site is growing and traffic is spiking.

    This site has been customized quite a bit through our own theme and I suspect this could be the problem

    This query is constantly apearing in my slow query list
    # Query_time: 6 Lock_time: 0 Rows_sent: 4 Rows_examined: 45008
    SELECT SQL_CALC_FOUND_ROWS wp_posts.* FROM wp_posts INNER JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relationships.object_id) INNER JOIN wp_term_taxonomy ON (wp_term_relationships.term_taxonomy_id = wp_term_taxonomy.term_taxonomy_id) WHERE 1=1 AND wp_term_taxonomy.taxonomy = 'category' AND wp_term_taxonomy.term_id IN ('3', '96', '97') AND wp_posts.post_type = 'post' AND (wp_posts.post_status = 'publish') GROUP BY wp_posts.ID ORDER BY wp_posts.post_date DESC LIMIT 0, 4;

    another example...
    # Query_time: 10 Lock_time: 0 Rows_sent: 16 Rows_examined: 45002
    SELECT SQL_CALC_FOUND_ROWS wp_posts.* FROM wp_posts INNER JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relationships.object_id) INNER JOIN wp_term_taxonomy ON (wp_term_relationships.term_taxonomy_id = wp_term_taxonomy.term_taxonomy_id) WHERE 1=1 AND wp_term_taxonomy.taxonomy = 'category' AND wp_term_taxonomy.term_id IN ('3', '96', '97') AND wp_posts.post_type = 'post' AND (wp_posts.post_status = 'publish') GROUP BY wp_posts.ID ORDER BY wp_posts.post_date DESC LIMIT 0, 16;

    I can figure out what's triggering it and how to optimize or even just cache it. I takes 3 or even 6 seconds to return the results. You can imagine what happens when over 14,000 unique visitors visit the site daily.

    I would appreciate if anyone could help me with this problem.

  2. Samuel B
    moderator
    Posted 2 years ago #

  3. ag211
    Member
    Posted 2 years ago #

    This is with super-cache turned on and nginx doing its magic...

    I have a lot of changes going on and I get the feeling the cached pages aren't served as much as one would hope.

  4. ag211
    Member
    Posted 2 years ago #

    I am glad to report that by installing DB-Cache in combination with WP Super Cache, I was able to remedy my problems. Site is now speedy like never before eventhough wećre getting tremendeous traffic spikes throughout the day.

    Slow queries donćt appear anywhere anymore.

  5. Frederick Townes
    Member
    Posted 2 years ago #

    @ag211, W3 Total Cache has very aggressive database caching and also supports a number of caching methods, I would highly recommend taking a closer look so that you improve the user experience of your blog even further.

Topic Closed

This topic has been closed to new replies.

About this Topic