If you're a WordPress developer, chances are from time to time, you just want a…
Contained within your WordPress database is a lot of superficial data, like post revisions, stored deleted posts and wasted tables. A leaner database, means a leaner site and cleaning it up can have a real positive impact on performance, but database optimization can be a tedious task. That’s where Optimize Database after Deleting Revisions helps.
What’s It Do?
Optimize Database traverses the MySQL database WordPress uses and cleans up what is not needed. This includes old post revisions, spam and trashed comments, deleted posts, and unused tags. The plugin will also optimize the database tables that it can, cleaning up unused rows and making sure that only what is necessary remains.
Each step of the customization is completely customizable, and you can choose which database tables are included in the optimization process. There is also an option to add a one-click optimize button to your admin bar, so you can run the tool automatically on the fly, or set up scheduled optimizations on an hourly, daily or weekly basis.
How’s It Work?
First things first, make sure you backup your database. You should never make changes there without making sure you can restore to an older version.
Once the plugin is installed and activated, go to Settings -> Optimize DB Options to customize the plugin. In the first section of the settings panel, you will see a text field to specify how many post revisions to keep (0 means that all post revisions will be deleted). The most recent number of post revisions will then be spared from deletion, and all others will be removed. You will also see checkboxes to include the deletion of trashed items, including comments, posts and media, spam comments, and unused tags. Below that will be a checkbox to “Keep a log” and a scheduler.
If you chose an option from the drop-down “Scheduler” menu, then the optimization process will be run automatically every hour, day, or week. I wouldn’t recommend this for starter users, but if you have a database that is constantly having content added to it, this might be a nice option. Finally, you’ll see an option to add a “1-click link in Admin Bar.” This will add a button to your admin bar at the top of your page so that you can run the process without having to access the Optimize DB tool.
Below these options will be a list of database tables, with a checkbox next to each. If you check any of these, that table will be excluded from optimization and will be left with all of its data untouched. In general, you won’t need to use this option, but if there is a plugin or section of your site you don’t want to be touched, you can change it here.
When you are finished, click “Save Changes,” then click the “Go To Optimizer” button or select Tools -> Optimize Database in the admin panel. To actually, start the optimization process, click “Start Optimization.”
The plugin might take some time to go through your database, but it will give you a report as it progresses. When it is finished, you will see a full report of what has been removed. It will list the revisions that were deleted, trashed and spam items that were removed, and database tables that were optimized. Next to some tables, you may see “Table does not support optimize, doing recreate + analyze instead.” This simply means that these tables are not stored using MyISAM, the default storage engine for MySQL and the engine used by WordPress core. If that’s the case, then the plugin will simply optimize as best as it can, but will most likely not get optimal results. Still, this prevents the plugin from having negative repercussions when managing these tables.
At the bottom of the report, you will see a comparison of your database size before and after the optimization process and a link to your log file if you chose to include it. It is a good idea to run this optimization every once in a while, as you find that your revisions and trashed/spam items are piling up.
Costs, Caveats, Etc.
The plugin is completely free, and the most well maintained of the optimization plugins I’ve come across. Plugins that interact with the actual database of WordPress are always a little riskier, but you shouldn’t run into much of a problem. But as I mentioned before, make sure to back up your database before you use it.
If you are looking for support, the developers are very active on the support forums, so you should post your questions there.