Every time you save an article an additional copy is stored in your database. Because there is no limit on the number of revisions saved by WordPress your MySQL database will become huge over time! Just imagine a website with 200 posts and a database of 10 MB. Now if you start storing 20 versions of every article your database will explode to 400MB.
A large database requires more resources and makes your website slower. Cleaning these revisions can reduce the size of your database by over 90%!
Let’s clean revisions in WordPress
Now there are a lot of ways, both manually and plugins, to remove all revisions from WordPress. However personally I want more control. I want to remove all revisions EXCEPT for the last 2. That way if I made a mistake somewhere then I still have 2 versions to fall back on.
step 1 Install plugin
Install the plugin ‘Optimize Database after Deleting Revisions” . https://wordpress.org/plugins/rvg-optimize-database/
If you are new to WordPress and do not know how to install a plugin please check out How to install a WordPress plugin.
step 2 Find the Optimize DB Options
Expand the Tools menu on the left side of your WordPress dashboard and click on Optimize Database.
Step 3 Change the Optimize DB settings
If necessary press the Change options button. Now enter the maximum number of Revisions. In this example I chose 2. Also make sure you check “delete expired transients” and” keep a log“. Both are marked red in the screenshot.
Optional: You could also check the trashed, spammed and unused tag boxes. Personally I always keep those folders clean so I do not need them.
Now press Save Options (also marked orange).
Step 4 Let’s Optimize your WordPress database
Press ‘Go to Optimizer’ and simply press ‘Start Optimization’.
Step 5 result
After a few seconds the results of your database cleaning will be displayed.
In this example only a few revisions were removed saving 174 KB. Obviously I have run the cleaning before. My total savings so far are a whopping 49 MB!
As an added bonus the plugin also did a MySQL optimize on all WordPress related tables.
With the right plugin for the job optimizing your MySQL database becomes an easy task. I hope you enjoy your clean WordPress database.