46:8 Battling a gruesome WordPress database - Lee Matthew Jackson
46:8 Battling a gruesome WordPress database - Lee Matthew Jackson

46:8 Battling a gruesome WordPress database

How to clean a slow and bloated WordPress database.

Lee Matthew Jackson
Lee Matthew Jackson
How to clean a slow and bloated WordPress database.

In this series, Lee looks at a range of WordPress tools that can add value to both the development process and client interactions. For each episode, Lee will define a problem, discuss his agency’s solution, and share a use case.

Lee Matthew Jackson - Trailblazer FM ™


Lee Matthew Jackson

Trailblazer FM ™

The problem

How do you deal with a bloated WordPress database, where, over time, the revisions, option changes, and alterations have grown out of hand?

The solution

We use Advanced DB Cleaner Pro to deep clean our databases, and repair and optimize. The tool is very powerful so we recommend a backup before you do anything and a thorough test of your site afterward.

Use cases

  • High-traffic websites to keep the database lean.
  • We share an example of a firewall plugin that filled the DB with junk.
  • Large multisite databases



WordPress tools to try before you die. Sorry about that. Time for the next tool.

Welcome to another episode of WordPress tools to try before you die, where we look at specific problems that a web agency may have. We present our solution in the form of a WordPress tool and we share with you some use cases. Right at the very end, you get the opportunity to share what your solutions would be to the very same problem. So be sure to check out the show notes to find out how you can get involved in the conversation. Today’s problem is the gruesome, the ugly, the ginormous WordPress database.

If you have a website that’s at least a year or two old, you’ll already know that the WordPress database can get ridiculously bloated revisions, site options, plugin options, you name it. The WordPress database can get huge. And we speak from experience. I’ve seen one multisite to database, for example, get as large as 15GB.

That is huge. And it doesn’t take a rocket science to work out that if you have a huge database with tonnes and tonnes and tonnes of information, then all of your queries are going to take longer. Over time, the performance of your website is going to suffer. It’s kind of obvious. And unfortunately, we tend not to look after our WordPress websites so much when it comes to keeping the database clean.

We might do that with our Windows computers, because we all know that over time, it gets bloated full of junk and we have to clear all of that out. Well, WordPress is pretty much the same, especially if you’ve tested a whole load of plugins on your website over the years and then remove them. Many plugins, unfortunately, don’t remove their junk. Essentially, you deactivate, you delete that plugin, but all of the old stuff that they left in the database is still there. We’ve had this problem both in sites that we’ve inherited or sites that we’ve supported for a very long time for clients, maybe over six or seven years.

And of course, over time, we have all of those revisions, all of those changes in options, all of those edits, and things have gotten a little out of hand. So the solution to this is for us, Advanced DB Cleaner Pro. And yes, we use the Pro version, but there is a free version you can check that out in the show notes, and quite honestly, the free version will give most websites what it needs. For us, we have Pro because we do also want to tackle things like all of those orphaned options or tables or cron jobs that have been added over the years. So very important for us.

We also like to support plugin authors and we also appreciate any of the technical support that would come with paying, because we’re supporting our clients. And we also want to make sure that the tools we use are supported. Our most used feature is the ability to set up a cleanup schedule. We can control revisions, the draughts, trashed, post comments, spam comments, trackbacks, you name it. We’ve got the ability to run a cleanup every seven or 30 days or whatever we choose.

Just depends on the size of the site and how much traffic or how much volume is going through it. We also set up a schedule to ensure that the tables are optimised again on a scheduled basis. On top of the cleaning and the optimization, we do a deep dive for our clients on things like the site options, making sure that we remove all of those orphaned options as an example. And we do the same for cron jobs as well, especially on some of those older sites. You can have orphaned cron jobs that are just all still sat there.

Primary use cases for us would be high traffic websites or websites that have had a lot done to them over the years and we need to give them a good cleanup. We have started installing this as standard on new websites to ensure that our websites are kept clean. But there are certain things you do need to do manually. So you may want to look at your website every six months or so and just see what’s changed. Is there anything that can be cleaned up?

Is there anything that can be removed? An example for us would be that we used to use a third party firewall, which we realised was actually logging all of the information in the WordPress database. We removed the plugin itself a long time ago, but we didn’t realise there were still seven orphan tables with thousands upon thousands of old logs in there that we just didn’t need. It was outdated information. So by running a scan with this tool, we were able to see those orphan tables and remove them and of course significantly reduce the size of the WordPress database.

So what would you do when presented with this problem of a ginormous and scary WordPress database? Of course, I can hear many of you saying that you wouldn’t install all of these random plugins and that you would adopt best Practises in your WordPress website would be super clean anyway, so you would never need to use such a tool. And I say hurrah to you, but unfortunately I live in the real world and these things happen and we end up testing things and things can get out of control. Your clients, you can’t control what your clients do. If they want to install things and test things, they’re going to do it.

So for us, hey, we found this has been super useful for us. Check out the show notes to find out how you can get involved in the conversation over in the comments. But did you know, if you want to have this conversation in person, then you can come to Agency Transformation Live 2022. That’s this year on the 10th and the 11th of November. Come and meet me in person here in the UK as we get together with agency owners from around the world for a day one conference with amazing speakers and day two an in-person mastermind where we use the combined brain power of the room to help you work out what your next small achievable actions are to move the needle in your agency. So, folks, head on over to agencytransformation.live if you want to be involved in that event or to the show notes to come and join us in the comments. Folks, if we don’t see you in the comments, if we don’t see you in the event, let’s see you in the next episode.


PodcastSeason 46

Lee Matthew Jackson

Content creator, speaker & event organiser. #MyLifesAMusical #EventProfs