Cleaning up the WordPress database becomes important in the order to increase the site’s speed. However, not many people take it seriously.
You’re here and reading this article shows how much you’re concerned about your website, which is a good thing.
In this post, I’ll show you how to clean a WordPress database faster. So, read the complete article to get the full info.
Before Cleaning Up Database, Make Sure To Create Database Backup
To back up the database, you can install Updrafts. It’s a great plugin that works for free. I am using it on one of my sites and it’s doing a great job in keeping my files and database secure.
Also, having backup lets you test many things on your site without any fear of losing. Updrafts allow many third-party apps/sites including Google drive to save your files and database.
Most bloggers prefer Dropbox to save files. However, I feel Google Drive is the best in terms of security and cost. Read the tutorial on how to create a backup using Updrafts plus.
Now, let’s begin the post and look at some of the most useful plugins to clean the database.
- 1 How To Clean WordPress database
- 2 Rank 1: WP-Optimize
- 3 Rank 2: Advance Database Cleaner
- 4 Rank 3: Optimize Database After Deleting Revisions
How To Clean WordPress database
- Install Wp-Optimize
- Go to Optimizations
- Select everything except Auto drafts and Remove unapproved comments
- Click on Run All Selected Optimizations
- Go to tables and clean tables as well
- Schedule Optimization.
Rank 1: WP-Optimize
WP-Optimize has over 1 million active installations with more than 1,444 five-star ratings. Bloggers love this plugin, it does the job for you without costing a single penny.
Also, WP-Optimize is by the same developer who made Updraftsplus. So, you can trust this developer. Now, let’s see how to clean up database and old plugins tables step by step with the help of WP-Optimize.
Step 1: Install And Activate The Plugin
The plugin is available in the plugin section of WordPress. Search “Wp Optimize” or Clear Database in the search tab and this plugin will be visible to you.
Step 2: Go To Optimizations
Once the plugin is installed, go to the database section. Three options will be visible to you – Optimizations, Tables, and Settings.
In the Optimizations section, select everything except Unapproved Comments and Clean Auto Drafts Posts. If you’re okay with the removal of Uaaproved Comments then select them as well.
Click On “Run All Selected Optimizations” to finish the steps
Now, let’s look at the meaning of Database Items to understand better.
- Optimize database tables
I think it’s the most important and has to be selected for optimization. It could speed up the loading time by claiming unused space in your database tables. It also reduces the extra burden from your site’s server.
- Clean all post revisions
Post revisions give you an idea of how many times you have reviewed your post. Once you published the post, there is no need to keep post revisions. It’s better to clean it up to free some space.
- Clean all auto-draft posts
Cleaning up your auto-draft posts is a terrible idea and you should not select it. Auto drafts save your posts every time you edit something automatically. It works as a very good assistant. I think it’s a cool feature and you should always let it turned on.
- Clean all trashed posts
Almost nobody undo trash posts. It’s a good idea to clean all the trashed posts to free some space and to optimize website speed.
- Remove spam and trashed comments
One of my sites receives thousands of spam comments every month which could frustrate anyone. Sometimes these comments take up a lot of space. By removing all these spam and trashed comments we can make our site faster.
- Remove unapproved comments
Sometimes we forget to approve some genuine comments. Removing unapproved comments might not be a good idea.
- Remove expired transient options
WooCommerce users might know what transients are, and for people who don’t about it let me tell you. It is a kind of cached data permitted in WordPress by the Transients API. You can use the transient to store data, but only for a while – a transient will have an expiration date and they can expire at whatever time.
Even when they expire, transients are not deleted– they are either removed when someone attempts to access the information in an expired transient or by you manually. These expired transients reduce the WordPress admin panel speed.
Clean expired transient to speed up performance.
- Remove Pingbacks
Pingbacks notify you every time someone links to your content or site. It may be helpful, but it has been noticed that it slows down sites. I recommend keeping them disabled.
- Remove Trackbacks
Trackbacks are also like Pingbacks. Keep it disabled.
- Clean post meta data
Post metadata shows users information about author name, posts published time, category of the post, and reading time. Wp_optimize will help you delete the most metadata that doesn’t belong to any pots.
- Clean comment meta data
Like post metadata, cleaning up comment metadata can also improve performance. Optimize it.
- Clean orphaned relationship data
Orphaned relationship data helps the plugin work well, However, once the plugin is deleted there is no need to keep this data. It’s better to clean it up.
Step 3: Clean Tables
In the Tables section of Wp-Optimize, you’ll see all the database tables. Look out for the tables that have a not installed tag with a remove button next to it.
Wp-Optimize can also inform you of the size and which plugin the table belongs to.
When you’ll click the remove button, the plugin WP-Optimize will show a waning pop. Something like this –
Click on remove the table to clear the data.
Step 4: General Settings
General Settings gives you some extra options like scheduling automatic database cleanup. I like to keep it once a week, but if your site is heavy and contains many plugins then you can decrease the automatic database cleaning schedule date.
Here is the ideal setting:
Make sure to save everything you’ve done.
Rank 2: Advance Database Cleaner
A great plugin to optimize the database. I’ve ranked it number to just because it is easy to use. A beginner won’t face any difficulty.
Also, it has over 70,000 active installations with 800 five-star reviews. It’s a genuine plugin to use but not better than Wp-Optimize.
Let’s look at the settings for Advance Database and how to clean up the database with the help of this plugin.
Step 1: Install And Activate
I know you know how to install and activate a plugin.
Step 2: Go To General Clean Up
In the general clean-up area, select everything except Auto Drafts and Pending Comments. Select clean from the drop-down and click apply to the clear database.
There is another great feature of this plugin, it lets you see cron jobs. According to Kinsta, A cron job is a task itself, which is used to schedule tasks at periodic fixed times, dates, or intervals.
Usually, these involve repetitious tasks that are automated to save time. In WordPress, this is controlled by WP-Cron, which is used to simulate a system cron.
Rank 3: Optimize Database After Deleting Revisions
According to the developer, here are the key features of Optimize Database after Deleting Revisions:
- Deletes revisions of posts, pages and custom post types (Also, you optionally can keep an ‘x’-amount of the most current revisions and you can choose to delete revisions older than…)
- Deletes trashed posts, pages and comments in one click(optional)
- Deletes spammed comments (optional)
- Deletes unused tags (optional)
- Deletes ‘expired or all transients’ (optional)
- Deletes ‘pingbacks’ and ‘trackbacks’ (optional)
- Clears the ‘OEMBED cache’ (optional)
- Deletes ‘orphan postmeta items’
- Optimizes the database tables (optionally you can exclude certain tables, or even specific posts/pages, from optimization)
- Creates a log of the optimizations (optional)
- Optimization can be scheduled to automatically run once hourly, twice daily, once daily or once weekly at a specific time (optional)
- ‘Optimize DB (1 click)’ link in the admin bar (optional)
- ‘Optimize Database’ Icon in the admin menu (optional)
- MULTISITE compatible: optimizes all sites in the network with one click
Now, let’s look at the steps to clean the database with the help of this plugin.
Step 1: Install And Activate The Plugin
To install the plugin, type “Optimize Database after Deleting Revisions” in the search box. Once activated, go to its dashboard.
Step 2: Select The Items Needed To Be Optimized Under Settings
Here is the ideal setting to clean up the database perfectly with this plugin:
It’s A Wrap
I recommend these three plugins to clean the database because they work well with any type of website. I am using Wp-Optimize on one of my sites which gets around 60k visits every month.
Optimizing a database isn’t a hard job, in fact, it just needs one click. It might be sounding difficult to people who have no experience of blogging, but WordPress is a place where a newbie can learn pro things easily.
Learn new things every day to get comfortable. One day you’ll become a pro and might start a blog like mine. However, do not put your site at a risk, create a backup so that if anything unfortunate happens, you don’t have to worry.