Too many SQL queries (8 posts)

  1. scentco
    Posted 2 years ago #

    We have just made this site live about a month or so ago and it just seems to be getting slower and slower. We are somewhat new to wp, but we have wp super cache enabled and we have spoke to our hosting company and all they can say is that it could be too many SQL queries. We've gone through and deleted any plugins we are not using. We've gone through the basic optimization suggestions for wp, but nothing seems to be correcting the issue. Sometimes I'll even get the "error connecting to database" error because it will time out. Any suggestions or help is welcomed. Thanks.

    URL: http://www.smencils.com

  2. leejosepho
    Posted 2 years ago #

    At my own host, there is a folder for "mysql_slow_queries" containing logs inside a "tmp" folder just outside my root folder, and there is where I have been looking at the queries that had been slowing things down and even causing my account to be throttled at times.

  3. I've had a bad theme use the wrong hook and create dozens of unnecessary database queries, so you might try a default theme like Twentytwelve or Twentythirteen. I also had great luck with DB Cache Reloaded Fix where the standard caching plugins weren't improving performance as much as I'd hoped.

  4. scentco
    Posted 2 years ago #

    Thanks leejosepho. I've found this same folder on my server and narrowed it down to a single query that is taking over 5 seconds to complete.

    It looks like the SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts INNER JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relationships.object_id) WHERE 1=1 AND wp_posts.ID IN

    This query is scanning our wp_posts table, which has over a 1,000 posts in it....

    Any idea on what this query is for and how to lower the time on it?

  5. leejosepho
    Posted 2 years ago #

    So far, I have only been deleting leftover queries related to plugins I no longer use, but I think the deal there has to do with adding or modifying a database table related to a needed query that happens to be running slow...and I have actually hired the individual who told me about all of that to take a closer look. Also, and if I remember correctly, anything you find in that log is considered slow even if it only shows taking a small fraction of a second.

  6. leejosepho
    Posted 2 years ago #

    I just found this and began taking a look:

  7. leejosepho
    Posted 2 years ago #

    I do not know enough to explain the details of what I have been doing about slow queries and cleaning up my databases, but here are the plugins that are helping to make that possible:

    note: Always begin with a backup, then take an overall look.

    note: Be cautious of deleting drafts you might actually want to keep.

    note: This one found things I had not seen anywhere else.

    note: Be sure to not modify anything you actually still need.

  8. leejosepho
    Posted 2 years ago #

    PS: I have also found this one, but I have yet to know what to actually do with its results...

Topic Closed

This topic has been closed to new replies.

About this Topic