Last week, as part of our ongoing quest to increase the speed of our website, we were tweaking our WordPress blog, we noticed a couple of things. The first was that there was a large portion of the loading time spent waiting for the database to respond. The second was that the time to first byte, at 641ms, was one of the largest parts of the response time.
After crawling around the interwebs looking for solutions, we basically could not find any advice that did not include moving to a better/faster server. Our research has shown that because time to first byte is the time it takes the server to start sending the data, there are really only three things you can do to reduce TTFB with wordpress;
- Move your website to a faster/better server
- Use a CDN or something similar to reduce the load on the server (repeated requests to a server will increase the TTFB)
- Reduce the time the server spends processing the request for information.
As we are not really prepared to move servers, and change the way our server worked, we thought there was little we could do. However, this morning there was something I noticed, and that was that the Wp_Posts was basically 10MB big. With WordPress’ reliance on MySQL, I knew this would mean trouble for any speed on the database.
Delete Revisions
Long story short, we found a “Delete Revisions” WordPress plugin, which does exactly what it says on the tin, deletes all the revisions of the posts and pages of your WordPress website. We backup our data every day, so it did not bother us to remove some of the thousands of old revisions from our blog. Some of the pages on this blog have been changed 30+ times over the years, and all that redundant data is stored in the database.
So, we ran the plug-in, and it found some 2500+ redundant revisions. Once we had removed these, it reduced the database by 9.6MB! We then went back to the MySQL and optimised the database. Now WP_Posts sits at a much more comfortable 1.6MB.
After that huge change, we went back to Load Impact, and found our website has gone from a total loading time of 4.94 s to a total loading time of 3.29 s. That is a 33% increase in loading speed. The time to first byte on the first call has gone from 641ms to 329ms, almost a 50% reduction in time.
We have written a more in depth analysis of time to first byte here.
Thank you so much, a plugin like delete revisions is exactly what i was looking for.
Hey, thanks for letting me know about this plug-in, buddy! I already installed disable automatic revisions (or something similar) but I forgot that if I press that Update button manually, WordPress still saves a revision.
I’m backing up my blog first as this plug-in detects quite a number of revisions.. a bit scared that it deletes the wrong posts 🙁
Thanks for the tip. I’ve done it on my website. It reduced my database size considerably. However, it did not too much to reduce TTFB. But It was expected since I’m on a shared host.
I have hyper cache installed and use a CDN but my TTFB is still awfully long. Like the poster I have search all over the interweb and have not found much useful info (at least nothing that helps a website newbie like me).
The advice to delete revisions seems to work for most people, but unlike they, I have a business site and don’t make blog posts too often. I will still look into it, thanks for the tip!
As I said in the beginning of the post, this is more than likely to do with the host you are on. Cheap, busy, popular hosts are unlikely to have put the resources into making sure their server/network is working as well as it could be.
after doing some tweaking, my website go fast but still TTFB have a F rank at webpagetest. i use cloudflare as CDN it help me boosting my site (except TTFB).
This was a very helpful tip. I could make my DB about 20mb lighter. Not sure why it never struck me earlier.