Today in this article we are going to learn something very important, very fundamental to running an efficient WordPress website.

How to clean up and optimize a WordPress database.

A database can easily be related to a house. Every time you do something, there is a change, there is clutter, there is disorganization so we regularly clean the house, organize stuff putting them in the rightful places. The next time you want something you will know where to find it rather than spend 5 minutes looking for where you last placed the item.

That’s exactly how your WordPress database works. Each time there is activity, say you create a post, edit a post, delete a post, a theme is installed or updated or uninstalled, a plugin is installed, a visitor leaves a comment, or spammy comment or just the general operation of the scripts running the website– clutter is left around, little bits of pieces of code eating up your disk space whilst choking up your database.

If this clutter is not dealt with, the performance of your website will soon deteriorate and we know how bad it can be not just for us but for the overall user experience with our website.

Every once in a while it is therefore a good practice to clean up and optimize your WordPress database for the best performance.

Important NOTICE.

Before attempting any type of action that has that potential to modify your database or files, make sure you have a back up copy for your database and or website files.

I can’t stress this enough.

Using a free tool like our very own WPvivid Backup Plugin you will save your hair if things go awry.

If your database or server happened to crash or be forcibly powered down at the same time as an optimization operation was running, there is a high probability that data will be corrupted.

The odds of such a catastrophic event happening are few, but, over the years we have had cases of the kind.

Our backup plugin will restore everything back to normal within minutes.

After you have made a back up of your database, let us learn how to clean up and optimize a WordPress database using WP-Optimize.

WP-Optimize Plugin

1.Install WP-optimize.

You can grab the files from or install it from your administrative backend.

Once it is installed, you may want to first view the status of your database. From the left Menu look for WP-Optimize > Click settings.

WP-Optimize settings

You should see how your database is fairing from there;

database status

2.clean up and optimize our WordPress database.

If you are on the settings page, click database button

Or Go back to the Main Menu WP-Optimize, and Click Database

WP-Optimize setting-database

It is from this screen that we clean up and optimize our WordPress database

optimizations runing

To clean the whole database in one click, Check the checkbox besides Optimizations to select all the tasks and then Click Run all selected Optimizations.

Optimizations-run all

You can also choose to clean up the sections individually, for that case Click the Run Optimization button on the right of whatever you want to clean up

optimizations-run single

It will take a couple of minutes for it to complete depending on the size of your database.

When  it is done, it should show you what has been deleted.

After optimizations

Is it easy, huh?

If you wish, you can configure the plugin to automatically clean up and optimize your WordPress database without you coming back to this page.

You can do this by going to settings and check the checkbox besides, Enable scheduled clean-up and Optimization.

Then select what perform during the automated clean up.

I must reiterate, have backup copies of your website and database just in case an unfortunate event occurs. WPvivid Backup plugin can be configured to automatically make backups of either your database or your complete website.

What you could do therefore is set the WPvivid Backup plugin to backup your files a couple of hours before the auto optimization of your database.

automatic optimiztions

A plugin like this will help you be a good steward of your WordPress website without having to phpMyAdmin or knowing a thing about MySql the database running your WordPress website.

Besides WP-Optimize, what other plugins can one use to clean up and optimize a WordPress database?

Other Database Optimization Plugin

1.Optimize Database after Deleting Revisions

Like the name sounds – this plugin cleans up the junk left behind after revisions are made on your website.


Another great plugin that uses proper WordPress delete functions instead of running direct delete MySQL queries.

It is however not compatible with: Meta Slider, Slider Revolution, Viba Portfolio and MailPress plugins.

If you are running any of those plugins, don’t test your luck. Use WP-Autoptimize

3.Advanced Database Cleaner

Like WP-Optimize Advanced database cleaner will deal with the garbage of your website. For those concerned, it is a GDPR compliant plugin.

It does have a pro version too that performs more advanced clean up tasks.

You can read more about it from their WordPress plugin page.

Having a clean and optimally running database is important for your overall website’s performance.

Many of the performance issues your will experience could be caused by a clogged database.  As the admin of your website it is your duty to regularly unclog it so your website visitors get a good experience and hopefully convert with profitable action.

In this article we have shown you how to clean up and optimize WordPress database using WP-Optimize a free plugin you can download and install from the WordPress repository or within the backend of your website.

As much as we need to have an efficiently operating database, we have also stressed the importance of making copies of our files before we attempt any task that may compromise the integrity of our database. A simple, powerful yet free WordPress plugin is WPvivid Backup Plugin.

You may also want to learn how to replace ulr in your database.