How to Blog: Your Comprehensive Source for WordPress Themes, Plugins, Tips, Tricks, Reviews and News

Subscribe to our newsletter for the latest WordPress tips!

Why So Slow?? The Joys of Slow Queries in the Database

WordPress as slow as a tired tortoise - WP slow

Wow. What happened – my site is now so sloooooooooow!

I’ve been away from the computer for quite some time.  My husband was diagnosed with end-stage liver disease out of nowhere last year and I’m his sole caregiver – it’s been brutal and terrifying.  He’s having a wave of feeling somewhat better so I jumped onto the computer b/c not working for months on end isn’t great for the income.  Low and behold my WP site on “How to Blog” is slow as molasses!  How can this be?  I’ve always done everything to optimize my site!  I haven’t made any changes in forever! My PageSpeed score is an A (94%)! And yet both pingdom and gtmetrix show the site as taking upwards of 23 seconds to load! Pingdom showed that at least 21 of those seconds were spent waiting for a response from my webhost, SiteGround.

Not good.

So, I put in a support ticket with SiteGround, but their response was not particularly helpful.  I was told that “some slow queries in your website’s database are causing it to respond slowly or timeout”, that this is the cause of the problems, and that I should optimize those queries in order to resolve the problem.  And that “database optimization is beyond the scope of our support and this is why you should contact a professional developer or optimize the database yourself”.  Followed by 3 links to information I already knew about how to optimize a database using phpmyadmin.

Only optimizing the tables in the database did not help one bit. Neither did repairing all of them.

So I started to wonder if maybe it wasn’t a database problem – maybe it was a plugin or a theme problem. And so I deactivated every plugin I was using and switched the theme to one of the default ones (Twenty Fifteen).  Result: NO IMPROVEMENT.  Site load time was still outrageously slow.  There wasn’t even a 1s improvement in the load time, and that was with no plugins and a naked theme.  At this point I was pulling my hair out because I’d pretty much reached the limit of what I could personally do to troubleshoot this issue.

I submitted yet another support ticket to SiteGround explaining all of the above and asked that they escalated it to a senior tech.  He asked me to set up a temporary Admin user for SiteGround support, which I did, and I told him that I was going to reactivate all of the plugins and my theme choice so he could see the site as it originally was.

I then actually reactivated all of the plugins I had been using, as well as my theme (Luxe from Thrive Themes).  And all of a sudden my site was just fine. Load time was back to normal.  Navigating the site was zippy.  The issue had been completely resolved (well, almost completely — the load time is still higher than I’d like – 2.5s when previously it was below 2s – but that’s a whole lot less than 23 seconds and something and something I can prove by better optimizing my site as even though my PageSpeed Score is A (94%), my YSlow Score is a C (78%).)

I replied to my SiteGround support ticket asking what they’d done to fix it and what the problem was (and why did it start out of nowhere).  To my surprise, their response was:

I checked the site and noticed that its performance has indeed improved. I wish I could explain what exactly happened, but I cannot say for sure. I guess that something was reset or some cache purged when you made the mentioned changes.

So my site is fixed and no one has any idea why.  Very perplexing. But all’s well that ends well…

Perhaps it’s like the well known adage of is something isn’t working right with your computer, tablet, or smartphone the first thing you should do is reboot it because half of the time that fixes the problem.

TAKEAWAY: If your site is acting incredibly slow out of the blue, for no explicable reason as you’ve made no changes to it, my advice is to:

  1. Ask for technical support from your webhost.
  2. MAKE A BACKUP OF YOUR DATABASE!! This can be done through any number of plugins – I recommend WP-DBManager  (expert users can accomplish the same thing directly from phpMyAdmin if they’d prefer)
  3. Optimize the tables in your database — I again used WP-DBManager to do this.
  4. Repair the tables in your database — yes, I again used WP-DBManager.
  5. Check if that fixed the problem.  If yes, do a happy dance.  If not, continue…
  6. If you are using any type of content caching plugins make sure that you clear the cache.
  7. Write down a list of all of the plugins that you currently have activated.
  8. Deactivate every single one of those plugins.
  9. Make a note of the theme you are using.
  10. Change to one of the default themes that is automatically installed with WordPress (I used Twenty Fifteen)
  11. Check to see if your site is now speedy — if it is then you may have a plugin conflict, a theme issue, or something else that requires a more extensive effort to diagnose and resolve. If so, I recommend checking out this excellent article by Jeff Starr (The Art of Troubleshooting WordPress) as that’s not what this post is about.
  12. Switch your theme back to the original one you were using.
  13. Reactivate all of the plugins you had been using.
  14. Check your site to see if is fast again.  If so, throw a party and celebrate.  If not, I again refer you toThe Art of Troubleshooting WordPress.

Don’t have a single clue as to why that worked for me, but it did.  Maybe it will work for you, too.  Hopefully you’ll never even have this problem in the first place.

Click Here to Leave a Comment Below

Leave a Reply:

Pin It on Pinterest

Share This