Recently I posted about how to clean house on your tag taxonomy in WordPress. I thought I might also suggest two plugins that will help you keep your WordPress MySQL database a little cleaner and a little faster. With the introduction of WordPress’ revision system, each time you edit a post or page, an entry is made into the database. While this can be helpful during the editing/revision process, after the post is live and no longer in review, the list of rows in the database can grow to the 100′s for each post depending on how many time it was edited. This leaves us with what is called ‘Overhead’. Here’s what the fine people over at Stackoverflow had to say about overhead:
Every database will, over time, require some form of maintenance to keep it at an optimalperformance level. Purging deleted rows, resequencing, compressing, managing index paths, defragmenting, etc. is what is known as OPTIMIZATION in mysql and other terms in other databases. For example, IBM DB2/400 calls it REORGANIZE PHYSICAL FILE MEMBER.
It’s kind of like changing the oil in your car or getting a tune-up. You may think you really don’t have to, but by doing so your car runs much better, you get better gas mileage, etc. A car that gets lots of mileage requires tune-ups more often. A database that gets heavy use requires the same. If you are doing a lot of UPDATE and/or DELETE operations, and especially if your tables have variable length columns (VARCHAR, TEXT, etc), you need to keep ‘er tuned up.
So how can we keep this to a minimum? There two plugins I recommend and use to keep my overhead to a minimum.
Delete-Revision – Download
Alright, apart from a little translation issue in some of the buttons, this plugin has done it’s job for me. Heck, even in the less than 30 minutes I’ve spent writing this, I already have 2 revisions just for this post.

Delete Pesky and unwanted revisions from old posts.
I’m not going to delete these revisions just yet, I would never delete a revision from an article I’m currently working on. But just yesterday I removed about 100 revisions from the database. That’s 100 rows in the posts table I don’t have to worry about. I strongly recomend that if you are going to be deleting things from the database, that you make a backup. I use a Cron script to optimize and backup. If you are a multi-author blog with quite a few posts going on at the same time, I might suggest that you coordinate a time for this action, when no one is in the middle of authoring. Just setup a time of about 20 minutes each week that you can go in and clean house on revisions. After you delete them, I then recommend the next plugin.
This plugin shows up in your ‘Tools’ menu and gives you a snapshot of the size of your database, as well as the amount of overhead that currently exists. With the click of a button that says ‘Optimize’ you can reduce the overhead and clean up those nasty bits of data left over.

The main screen of Optimize DB
You might be saying at this point that 7.1 KB of overhead isn’t that bad right? Well keep in mind that I run a few automated Cron scripts to optimize my databases every Sunday evening. At times, depending on the work I’ve done throughout the week, this can be an overhead of up to 512kb which in the scheme of things, is about 1/3 of my total database in overhead. Yikes!
Hopefully these two plugins will give you a little more control over the mess that can become your WordPress database. I wish you happy optimization and low overheads
.
Cheers!
Discussions