How bloated is your WordPress database? Sometimes it seems that no matter what you do to optimize your site, it’s still a little sluggish. You should be using a database cleaner.
Trashed posts, revisions older than dirt, and useless comments are all things that weigh down your site. And after several years of installing and uninstalling plugins, you probably have a bunch of useless tables in your database that can be deleted.
You could go through all of this manually, of course. Depending on how much free time you have to muck around and hope you don’t miss anything, it’s entirely possible. But I think you would more likely appreciate a tool that will help you do it faster and not leave anything behind or — gulp — delete something in WordPress core.
Using the Database Cleaner plugin, I’ll show you how to clean your WordPress database easily and completely worry-free. We may have found the best database cleaner for WordPress!
Get a Thorough Cleaning with Database Cleaner
This deceptively simple plugin is more than pretty — and it is pretty — Database Cleaner analyzes your database and makes recommendations dynamically, adjusting to changes such as adding new plugins or removing plugins.
The plugin works great for small sites and can handle your big database just as well. It uses smart, controlled queries to efficiently clean any size database.
Database Cleaner will remove temporary data. That’s helpful. But the plugin does exceptionally well optimizing your site, going a step further than just taking out the trash.
In the next section, we’ll look at installing and getting the most out of the Database Cleaner plugin.
How to Clean Your Site with Database Cleaner
The Database Cleaner plugin will analyze your site and first show you a ton of data about your database. Then it will give you options to remove items or leave them alone. There are as many ways to handle cleanups as there are WordPress sites, so you may find that you customize options differently on each site.
First, let’s get the plugin installed.
Start by downloading the Database Cleaner plugin directly from its WordPress.org page.
After you’ve downloaded the plugin zip file, navigate to the Admin Dashboard of your WordPress site. Select Plugins>Add New. Click Upload Plugin and browse for the .zip file you saved. Click Install Now, then activate it.
You can also search for the plugin right from your WordPress site. In the Admin Dashboard, select Plugins>Add New. In the search bar, look for “Database Cleaner,” and you’ll see it appear as an option. Click Install Now and then activate it.
Now, in your dashboard left-side menu, you’ll see a new item called Meow Apps. Hover over that, then click Database Cleaner to access the dashboard.
Note: If you were previously using the standard version of the plugin and are now upgrading to Pro, you’ll need to uninstall the standard Database Cleaner first. You can then upload and activate the Pro version. You’ll then need to paste your license code under Settings>License.
Configuring Database Cleaner
The first thing you might notice in the dashboard is that Database Cleaner shows you the size of your database. It also gives you a little graph showing the evolution of the database size. You can refresh this anytime by clicking the blue refresh icon.
There are several tabs across the top of the menu window with various settings. On my site, I have it set to Expert mode. Under Easy mode, there are fewer tabs and available options to consider. Let’s go through all of them and see what they do.
The first rule of WordPress is “Don’t hack the core!” That’s because WordPress does its job well, and there’s no need to hack the code. However, over time the database gets clogged with data in the course of making changes, and some of it can be deleted. Cleaning the database isn’t hacking the core and doesn’t change anything in the software itself — only the database.
In my example, Database Cleaner found some duplicated user meta.
In the right two columns of the Users section of the menu, I can see that Duplicated User Meta is showing a Count of 17, and the Mode is set to Auto.
The Mode option is where you control how the data is retrieved and cleaned. When set to Auto, it will automatically be retrieved and cleaned when you click the Auto Clean button at the top of the dashboard.
Under Manual, you’ll need to manually refresh and clean; under Never, it completely ignores that item.
You can either click the trash can next to the item or use Auto Clean. Presto! The database is cleaned for you. In my example, the menu now shows 0 under the Count for Duplicated User Meta.
Click the refresh button above the Posts, Posts Metadata, Comments, and Transients menus to see the counts. Then click the trash can or Auto Clean to clean them out.
What are Post Types? In WordPress, any kind of post gets stored in the database. The most obvious ones are blog posts, pages, and products — if you have a WooCommerce store, for example.
The not-so-obvious ones are custom post types, typically created when you install and use a theme or plugin. These can be logs, libraries, or other data the plugin needs to store and retrieve to function.
I can see Post Types for Elementor, WooCommerce, and Spotlight in my example. There is also one that’s crossed out: scrollsequence. I have the option to choose which plugin I want to associate the post type with. I can also click the Not Used link at the top, and it will show me the same item. That’s because I don’t currently have the Scrollsequence plugin activated.
I want to be cautious here because if I clean this item from the database, I may have issues if I reactivate the Scrollsequence plugin.
It’s also notable that any Post Type associated with WordPress is grayed out and the Mode set to Never by default. This is a great feature. Unless you really know what you’re doing, you should probably leave those WordPress items alone.
In the Tables menu, the links at the top for All, Not Used, Used, and Unknown are super handy. For example, if you click on Not Used, you’ll see a list of items in the database that WordPress doesn’t currently need. Typically these items are leftover after removing a plugin or something similar. The Used By column will tell you exactly where the item was used.
Suppose you know that you have removed and are no longer using a plugin. In that case, you can safely delete the items associated with it. In the far right columns, you’ll see the file size and relative percentage of space being taken up in your database.
When you check the Unknown link, it may not be as clear which items can be safely removed. You may need to do a little research to find out about the association.
You can also choose to optimize the table rather than remove it, which is done by clicking the rocket icon on the far left.
There is also a helpful “Hide items used by WordPress” checkbox at the bottom.
You’re probably getting the idea now that plugins add a lot of data — some useful and some not. In fact, some of the most unnecessary data created by plugins are registered in the options table of your database.
Autoloaded options can be the most insidious. Many of these options don’t need to be retrieved to load your WordPress site; useless ones will bog it down. You have two choices in the Database Cleaner Options menu: You can remove items or turn off autoload for them.
Configuring this section can be tedious, but you may see the most significant gains here.
Every WordPress site runs cron jobs, actions that occur behind the scenes on a scheduled basis. An example would be a news site that gathers RSS feeds to be displayed on the page. The cron job will automatically update the feeds at whatever time interval the user sets.
Settings & Logs
In this menu, you can set how often you want Auto Clean to run for you and the Batch Size or maximum amount of entries to be processed at once.
Database Cleaner is free to install and use. However, there’s a Pro version that gives you extra features.
With the Pro version, you get an Enhanced “Used By” column for Tables, Post Types, and Options. The column will try to show which plugin might be using a particular item.
You also get an Automatic Cleaning feature. This works continuously in the background, emitting tiny requests so as not to affect performance. This is in beta, so I wasn’t able to test it — it is coming soon.
Under the Pro version, the pricing is in tiers, based on the renewal rate and how many websites you are using it on.
Database Cleaner: An Easy Optimization Tool
If you feel like you’re hitting a wall in speeding up your WordPress site, try cleaning your database. And rather than take on the chore yourself, get some help! Use Database Cleaner to do the heavy lifting.