How to compress the WordPress database

Over the course of the past few posts I’ve shown you how to clean up the post revisions in your WordPress database and limit them in the future, and how to remove the spam comments from the database as well.

Now just removing them may make things a little quicker, but to optimise things even more we need to compress the database so that the areas where those things were stored are not just marked as “deleted”, but remove completely.  This compresses the database and makes it smaller.  In some cases, that compression can be considerable.

To do this, we’re going to re-visit a plug-in that I’ve talked about before: WP-Optimize.

WP-Optimize can be installed from the WordPress repository, and in face it can also do a lot of the tidying up that we’ve done with other plug-ins now.  But it does not allow quite so much control over everything, so it either removes all post revisions or none at all.  I prefer leaving them there for a while, in case I want to go back to something.

Anyway, WP-Optimize only has one screen, where you can choose which actions are to be carried out.

The options in WP OptimizeSince we have done the rest manually, we just need to select “Optimize database tables” and click on “Process”.

If you want to know how much difference that will make to your database, scroll down to the bottom of the page beforehand.  There you will find the total size of your database and how much it will be compressed by.

The database size information.That’s it!  Now that the database has been optimised and the revisions and spam comments removed, it should perform better and make the site faster.  Obviously it is worth re-visiting this plug-in regularly to make sure that the database stays that way.

About Graham Tappenden

Graham Tappenden is a blogger from Germany. He has written code for WordPress themes since 2006 and been creating websites since 1994.
This entry was posted in Other Technical Stuff, Plug-ins and tagged , , , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *