• Hi, i have a problem with my site

    It’s very slow, i contact with my datacenter and sent me this:

    Your server is overloaded because there are a lot of mysql queries which you can see below. The queries are no completing fast enough and overload entire server. As you can see there are queries which are running for 60-70 seconds which is unacceptable. Your developer need to check and optimize them.

    ——————————————–+
    | 2388 | user | localhost | blog | Sleep | 71 | | |
    | 2390 | user | localhost | blog | Sleep | 87 | | |
    | 2475 | user | localhost | blog | Sleep | 1 | | |
    | 2476 | user | localhost | blog | Sleep | 43 | | |
    | 2488 | user | localhost | blog | Sleep | 40 | | |
    | 2489 | user | localhost | blog | Sleep | 3 | | |
    | 2492 | user | localhost | blog | Sleep | 39 | | |
    | 2494 | user | localhost | blog | Query | 21 | Copying to tmp table | SELECT wp_terms.slug, wp_posts.ID,
    wp_posts.post_name, wp_posts.post_title, wp_posts.post_author |
    | 2495 | user | localhost | blog | Sleep | 39 | | |
    | 2516 | user | localhost | blog | Query | 21 | Writing to net | SELECT wp_terms.slug, wp_posts.ID,
    wp_posts.post_name, wp_posts.post_title, wp_posts.post_author |
    | 2517 | user | localhost | blog | Sleep | 29 | | |
    | 2518 | user | localhost | blog | Sleep | 1 | | |
    | 2519 | user | localhost | blog | Sleep | 28 | | |
    | 2524 | user | localhost | blog | Query | 19 | Copying to tmp table | SELECT wp_terms.slug, wp_posts.ID,
    wp_posts.post_name, wp_posts.post_title, wp_posts.post_author |
    | 2525 | user | localhost | blog | Sleep | 21 | | |
    | 2529 | user | localhost | blog | Query | 17 | Copying to tmp table | SELECT wp_terms.slug, wp_posts.ID,
    wp_posts.post_name, wp_posts.post_title, wp_posts.post_author |
    | 2530 | user | localhost | blog | Sleep | 19 | | |
    | 2533 | user | localhost | blog | Query | 11 | Copying to tmp table | SELECT wp_terms.slug, wp_posts.ID,
    wp_posts.post_name, wp_posts.post_title, wp_posts.post_author |
    | 2534 | user | localhost | blog | Sleep | 13 | | |
    | 2535 | user | localhost | blog | Sleep | 3 | | |
    | 2536 | user | localhost | blog | Sleep | 12 | | |
    | 2540 | user | localhost | blog | Sleep | 0 | | |
    | 2541 | user | localhost | blog | Sleep | 9 | | |
    | 2542 | user | localhost | blog | Query | 4 | Copying to tmp table | SELECT wp_terms.slug, wp_posts.ID,
    wp_posts.post_name, wp_posts.post_title, wp_posts.post_author |
    | 2543 | user | localhost | blog | Sleep | 7 | | |
    | 2544 | user | localhost | blog | Query | 3 | Copying to tmp table | SELECT wp_terms.slug, wp_posts.ID,
    wp_posts.post_name, wp_posts.post_title, wp_posts.post_author |
    | 2545 | user | localhost | blog | Sleep | 7 | | |
    | 2546 | user | localhost | blog | Sleep | 0 | | |
    | 2547 | user | localhost | blog | Sleep | 5 | | |
    | 2548 | user | localhost | blog | Query | 1 | Writing to net | UPDATE wp_options SET option_value = ‘a:8:{i:0;b:0;s:29:\”nextgen-gallery/nggallery.php\”;a:2:{i |
    | 2549 | user | localhost | blog | Sleep | 4 | | |
    | 2550 | user | localhost | blog | Query | 1 | Copying to tmp table | SELECT SQL_CALC_FOUND_ROWS wp_posts.* FROM wp_posts INNER JOIN wp_term_relationships ON (wp_posts. |
    | 2551 | user | localhost | blog | Sleep | 0 | | |
    | 2552 | user | localhost | blog | Sleep | 4 | | |
    | 2553 | user | localhost | blog | Sleep | 1 | | |
    | 2555 | user | localhost | blog | Sleep | 1 | | |
    | 2556 | user | localhost | blog | Sleep | 2 | | |
    | 2557 | user | localhost | blog | Query | 0 | Sending data | SELECT SQL_CALC_FOUND_ROWS wp_posts.* FROM wp_posts WHERE 1=1 AND wp_posts.post_type = ‘post’ AND |
    | 2558 | user | localhost | blog | Sleep | 0 | | |
    | 2559 | user | localhost | blog | Sleep | 0 | | |
    | 2560 | user | localhost | blog | Sleep | 0 | | |

    what can i do to fix the problem?

    Any help?

Viewing 15 replies - 1 through 15 (of 25 total)
  • I have the same problem! Can anybody please help?

    If you are using pretty permalinks, e.g. /%postname%/ or /%category%/%postname%/ and have a lot of posts on your site this can cause too many queries.

    Read this. It is a good explanation.
    http://digwp.com/2011/06/dont-use-postname/

    One solution is to add some text before /%category%/%postname%/ like /!/%category%/%postname%/ or any other text.

    I also use the Debug Bar plugin to analyze the number of queries. You need to change your wp-config file to read:

    define('WP_DEBUG', true);
    	define('SAVEQUERIES', true);

    for the Debug Bar to work. (change it back after debugging).

    Thank you so much, the structure I’m using is:

    http://www.mysite.com/2011/07/08/sample-post/

    or the “Day and name” of the default choices.
    I do have a blog with lots of traffic and thousands of posts. Should I change structure? What will happen if I do? Will all the links back to my site be lost?

    This permalink structure is fine, it shouldn’t cause any problems and you don’t need to change it.

    To reduce the number of SQL queries, you could look into using a cache plugin like WP Super Cache or W3 Total Cache.

    Thank you! I already use the W3 Total Cache plugin…
    what’s wrong then?

    Guys, records like this one:

    | 2516 | user | localhost | blog | Query | 21 | Writing to net | SELECT wp_terms.slug, wp_posts.ID,

    is cause from permalinks, right? So is the problem there?

    There may be someone who can answer this better than me with more experience with big sites but I would start troubleshooting by going through the templates and analyzing which functions are querying the database and see you can optimize them.

    Are you on a shared server? Can you increase the memory of your mySql server?

    I’m on a dedicated server with 4GB or ram and 4xeon processors…

    You may not want to do this on a live site but you could set your permalink structure back to the default and see if the site goes faster. Then you would narrow it down to the permalink structure.

    I am going to bow out now (though follow the thread). Hopefully you will find someone with more experience with larger sites to find an answer for you.

    So you still think it’s somehow the permalinks structure?

    What Theme are you using?

    What Plugins do you have active?

    How many queries are being executed on each pageload?

    I have also experienced a very slow WordPress site, plus another problem: I think the site itself is malfunctioning. When I try to add a new post in Visual (I’m VERY nontechnical), I cannot edit the text I enter in the text box; it won’t respond to any of the little boxes above the text box (boldface, or italic, or “link”, or Block quote, etc). It is very slow to add pictures. And when I switched to HTML, I was able to enter a link – but it didn’t give me the option of “open in new window,” which is important to me. These are all NEW problems; all my previous posts went smoothly, and in fact when I went back to edit one of the old posts, it acted normally.

    What’s going on?

    I don’t think the problem is “permalink structure” whatever that is, because NOTHING HAS CHANGED since my last post. And I don’t think the problem is too many “SQL QUERIES” whatever that is, because I haven’t initiated any queries of any kind, and my site doesn’t generate very many queries.

    I think there’s a problem with the WordPress site. How does one get it fixed?

    tcschaffer

    @tcschaffer start a new thread for your issue; it is doubtful that your issue is related to this one.

    The theme is “The Source” by elegantthemes (you might want to know that it uses timthumbs) and the plugins are:

    Akismet
    Best Related Posts
    Capability Manager
    Collapsible Elements
    Collapsing Archives
    Comment Rating
    Contact Form 7
    Datafeedr Random Ads V2
    Google Analyticator
    Google XML Sitemaps
    jQuery Colorbox
    MCEComments
    NextGEN Gallery
    Ozh’ Better Feed
    Quote Comments
    SexyBookmarks (by Shareaholic)
    SFC – Comments
    SFC – Publish
    Simple Facebook Connect – Base
    Smart Youtube
    Subscribe To Comments
    Top 10
    Wizzart – Recent Comments
    WordPress.com Stats
    WP-DBManager
    WP-Polls
    WP Ajax Edit Comments
    WP Super Cache
    WPtouch

    The page has a total of 133 HTTP requests and a total weight of 1680.8K bytes with empty cache

    So, if you switch to the default Theme (Twenty Ten), and disable all Plugins, does performance improve?

    The Theme itself could be an issue (I’m not familiar with the coding practices of ElegantThemes). Look for raw SQL queries (among other things) as potential resource issues.

    TimThumb is a huge issue, and will impact your performance.

    Also: 133 HTTP requests? Yeah, that’s a problem!

    Try running your site (as-is, currently) through Google PageSpeed, and see what it reports.

Viewing 15 replies - 1 through 15 (of 25 total)
  • The topic ‘Too many SQL Queries – Extremely slow wordpress site’ is closed to new replies.