• I use WP 3.51 for my site and am having problems with my webhost throttling my account because of slow mysql queries. Below is one such query. I used * to blot out some numbers and my database bame since I’m not sure how much I should include and what I shouldn’t.

    You’ll see the query was really slow. It was 32 seconds and they say throttling happens to any account that has a sql query over 1 second. Can anyone tell me what could be causing this? Easy answer is “a plugin” but can anyone with expertise guide me to what kind of plugin or if it could be something else?

    Here is one of my recent slow queries. I’ve had others that look at 4000 rows, but this one only looked at 6. But the query took 32x longer than what my web host allows before throttling my account.

    Thanks for any help you can provide,
    Brian

    RECENT SLOW QUERY
    # Tue MAR 26 05:22:39 2013
    # Query_time: 32.903254 Lock_time: 0.000836 Rows_sent: 3 Rows_examined: 6
    use the*****_wrd335;
    SET timestamp=13***59;
    SELECT wp_comments.* FROM wp_comments JOIN wp_posts ON ( wp_comments.comment_post_ID = wp_posts.ID ) WHERE post_status = ‘publish’ AND comment_approved = ‘1’ ORDER BY comment_date_gmt DESC LIMIT 3

Viewing 3 replies - 1 through 3 (of 3 total)
  • Mind if I ask which theme you are using? Also, which provider are you using to host your site?

    Thread Starter Brian

    (@gophumek)

    I’m using the Swift theme and hosted by Bluehost.

    Sorry for the delay in responding… In all honesty, your problem really lies within the statement WHERE post_status = ‘publish’ AND … How many posts does your blog have, and I would honestly refer you to the MySQL website along with, your themes ‘forum’ and see if anyone else has run into this problem…

    The search from publish could be really slow on a large website and not having your MySQL tuned properly… I was working on one of my sites that used the somewhat the same statement to search for videos (believe it or not) through all my posts, almost four years with, extrapolate the appropriate data and send it to a “slider” in one of the sidebars… What I did was used the WordPress codex pages and rewrote the query to reflect ‘specific’ categories however, I see in your case it is ‘comments’… Is this by some chance a spam plug-in, would you have a link to the slow page? I am going to guess this code exists within your single.php or possibly a comments.php It would be nice to see the source code via a we page link (will do)…

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘MySQL Problem’ is closed to new replies.