When you have a WordPress website, especially if it is for a long time, you start unknowingly leaving some stuff on the database that you’ll probably never use again, and that can be a factor of slow performance. That’s why it’s important to have a clean and efficient database.
The process of cleaning your database could be done manually but we don’t recommend that because you will spend a lot of time removing files. And that is why in this post we are going to explain you how to clean your database automatically.
Why Cleaning and Optimizing your WordPress Database?
The most important benefit of cleaning your database is that your WordPress website will have better performance. Similar to the process of doing speed optimization, where you compress images, configure cache, etc, when cleaning the database, your WordPress website will improve its performance, as there will be fewer dumb files to process. This is very similar to cleaning an old PC, where after removing unnecessary files, the performance gets better.
Even if the final website speed doesn’t improve a lot after this change, you will see that the overall performance and speed of the WordPress Dashboard will improve, so when you are adding posts, editing pages, or making tweaks to your website on the WordPress dashboard, you will be able to do it more smoothly.
The good news for you are: there are plugins for everything. You can install some plugins that will automate the process and you will barely need to spend your time on optimizing your database!
In this post we’ll show you how to use some plugins to clean your WordPress database, so you can easily keep your database organized and optimized.
What am I cleaning? You may ask. The short answer is that you are removing files that are saved by WordPress and were useful in that moment, but not anymore. For example, the post or page revisions that let you restore a specific time when you were editing. These files are not useful now since you have already published the article and you have a definitive version.
Advanced Database Cleaner
The first plugin we are going to show you is the Advanced Database Cleaner, which has both free and premium versions to download. Its main function is to delete unnecessary data stored on your database like spam comments and old revisions. In this way, you reduce your WordPress database size, and that means faster WordPress performance.
To install it, you just need to go to download the plugin on the free plugin directory or buy the premium plugin on their website, download it, and install it. For the free version, you can also directly install it on your WordPress dashboard from Plugins > Add New and search for the plugin. Once installed, you will see that the WP DB Cleaner tab will be added on your sidebar.
Once you install it, you will see there are different tabs such as Clean Up, Scheduler, Optimize, and a few more. Let’s go into these in a little more detail.
The Clean Up feature is the most important and essential part of this plugin. You can easily select database elements that you don’t find useful anymore, and quickly select them to be deleted.
As you can see on the screenshot, you just need to select the elements to clean, change Bulk Actions to Clean, and click Apply. Depending on your needs, you can select all or just the ones you would like to be removed.
Another great feature of the plugin is the Schedule feature to periodically run the cleaner, to ensure your database is always clean.
As you may saw on the screenshot above, on the right of the elements to clean, there is a Schedule option, where you can choose the length of the period that you would like to take the plugin to clean your files, and after that, you can just click save, and you’re ready to go.
Once you add a Schedule task, you can easily go into the Scheduled Tasks tab, and you will find these, just in case you want to remove it in the future, or anything else.
Just right to Optimize, there is the Tables tab, where you can directly delete database tables that you don’t find necessary anymore.
Beware of deleting anything without clear knowledge of what you are doing, as deleting a whole table can remove a lot of data, and affect your website.
This feature is specifically created to delete old WordPress tables from previous plugins or themes. So, if you used to have some plugin or theme, and you are not having it anymore, it’s very likely that the data is still being saved on the database and it’s OK to delete it in order to save space and clean it.
And that’s all for the plugin. There are other options and premium features available too, but, the most important functionality is the one we mentioned here.
So, to sum things up, Advanced Database Cleaner is perfect for you if you want a user-friendly plugin that can save you a lot of time by helping you to clean your database and improve the WordPress performance of your sites. Also, the more advanced features to remove tables and other advanced settings come handy from time to time.
Optimize Database After Deleting Revisions (Plugin)
Let’s go to the next one. Optimize Database after Deleting Revisions is a free and self-explanatory plugin with a simple-but-useful interface. Different to the plugin mentioned above, this plugin includes important features to automatically remove WordPress revisions older than a certain quantity of days.
The great benefit of this plugin is that you can schedule how often you want to run the optimization. Also one important aspect of this plugin is that you can exclude specific posts from deleting revisions. In this way, the plugin will not touch specific pages revisions you don’t want to change.
Let’s take a look at how you can use the plugin to clean your database.
To install it, you just need to go to the plugin page, download it, and install it, or, directly install it on your WordPress Dashboard from Plugins > Add New. Once installed, you will see that the Optimize Database tab will be added in your settings.
Click on the Optimize Database section to see what the plugin has for you. The overall main features are the following:
Optimize your database
This is the main feature of the plugin. Here you can easily select all the aspects of the optimization you want to use according to your needs.
As you can see, another difference with the last plugin is that Optimize Database can also eliminate unused tags, which can be very useful in terms of organization.
To apply the optimization choose all the options you would like to use and click on Go To Optimizer.
After that, you’ll get a summary of the actions of the optimization. There you can see all the changes Optimize Database has done.
You can set optimizations from an hourly to a monthly basis so you can do it once and forget about it for the rest of your life.
As you may saw on the screenshot above, you can have complete control and choose the exact hour you would like the optimization/cleaning happen.
Exclude Database Tables for Optimization
With this option, you can choose the tables that you don’t want to be changed. This is important if you want to keep specific information for any reason.
If you want to clean all the tables you can just ignore this option.
If you want to make the exact same actions every time the plugin runs an optimization, you can save the settings.
As you may saw on the screenshot above, you can save the settings of the database tables you want to exclude separately.
And that’s all for this plugin. We just showed you the main functions of the plugin, and as you can see it’s really easy to use and you can save a lot of time with it.
In summary: Optimize Database After Deleting Revisions is great if you are a bit picky about what you want to remove or not. Scheduling is easy and can automate an essential process to get a better WordPress performance on your websites.
Lastly, we’ll show you WP Optimize, which has both free and premium versions to download too. WP Optimize is not only made to optimize the database, but also to compress images and other aspects of WordPress. However, we’ll concentrate on the database optimization options.
To install it, you just need to go to the plugin website, download it, and install it, or, directly install it on your WordPress Dashboard from Plugins > Add New. Once installed, you will see that the Optimize Database tab will be added on your sidebar.
Let’s see how WP Optimize can be useful for our purposes.
After installing and activating the plugin, you can go to the WP Optimize which is in your dashboard sidebar and click on the database tab to see the options you have to clean your database. The options available are the following:
One important setting of this plugin is that it lets you keep data from a recent period. To use it, you just have to click on the Settings menu and choose to Keep last weeks data. You can ignore this function if you want to clean all the data you have.
This is another setting that allows you to schedule all the optimizations. It is just after General settings, as shown on the screenshot below. You can schedule on a weekly, fortnightly or monthly basis with the free version of WP-Optimize. If you want to have other options to schedule, you will have to upgrade to premium.
Now that you just configured the scheduler and the General Settings to Keep last weeks data, we will continue with the features in the Database menu that will allow you to run optimizations and see options for each database table.
This feature gives you all the options available to optimize your database. To activate it, click on the Database menu and enter to the Optimization tab. You can choose lots of options to run an optimization, which include optimize database tables, clean all post revisions, clean all auto-draft posts and remove spam/unapproved comments. WP Optimize will show you what changes you need to get a junk-free database.
In this tab, WP Optimize will mark the inactive tables that you can remove with one click. Even though the plugin makes easier to identify which tables are not being used, we still recommend you to only use this option if you have specific knowledge of what you are doing, as each database table contains a lot of data.
And that’s what WP Optimize has for us in the free version to clean your WordPress database.
In sum, WP Optimize is what you are looking for if you want to have an all-in-one optimizer plugin since it doesn’t only optimize the database, but also images and settings. With the option of keeping recent data, you can always keep recent posts or pages revisions you may still need, and after some time, these will be deleted automatically.
In conclusion, it is crucial to clean your database if you want the best WordPress performance both from a speed optimization standpoint, but also from a dashboard performance optimization too.
You don’t need to spend time cleaning your database manually because the plugins we introduce you can be way more efficient and you can configure them to do it periodically for you, just as your personal cleaner robot. And finally, the great thing about these plugins is that, as you could see, all of these plugins have free versions, so just in case you need some more complex functionality, you can consider purchasing a premium version later, but otherwise, you can have a perfectly clean an optimized database for free.