Tools for Optimizing Your WordPress Database

Optimizing your WordPress database can help keep your site running at full-speed.

The WordPress database is the home for your website’s content, theme settings, plugin settings, users, and more. That means overtime WordPress needs to find any bit of data your site uses it has to look in the database. A bloated database can slow things down.

Optimizing your database can help remove some of that excess data. As one stackoverflow user put it:

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.

Common Causes

General WordPress Usage

Any WordPress site that gets updated frequently is making UPDATE and DELETE calls to the MySQL database. Overtime it just needs to be cleaned up. Similar to defragging a hard drive.

Post Revisions

The sneakiest cause of WordPress bloat, in my humble opinion, are post revisions. A great feature for sure, but if you create hundreds of posts each with 100s of revisions your database will blow up fast.

If you happen to use the Calypso editor watch out, your post revisions will skyrocket. It’s typical for me to have 100+ post revisions by the time I’m done writing a medium size post with Calypso.

Plugin Settings and Tables

Lot’s of plugins will add settings to your wp_options table, but a lot of theme don’t clean up after themselves once you’ve deleted the plugin. I’m looking at you Reading Time WP developer1.

Other plugins will add their own tables to the database. This is great for keeping things nicely organized while using the plugin, but if you delete the plugin you really have no need for those tables anymore2.

Picking good plugins can help prevent some of this form of database bloat.

Optimizing Your WordPress Database

Luckily this is WordPress. It runs 28% of the internet so many others smarter than myself have developed tools to help you clean up your database.

STOP: We’re talking about your database here so before doing any of this make sure you have a backup of your site.

WP-Optimize

WP-Optimize is a free plugin that let’s you easily optimize tables, clean up post revisions, trashed posts, spam comments, and more.

All you need to do to run it is install and activate the plugin. Select the optimizations you want to run. And click the big Run Optimizations button3.

WP Optimize Settings

Manage WP

Manage WP is a service used to make it easier to manage multiple WordPress instances. It can do everything from auto-backups, plugin updates, SEO analysis, and uptime monitoring to of course, database optimization.

It’s very easy to use, once you sign up for the service and get your site added you can navigate to your site’s dashboard and see the optimizations available. The nice thing is you can take your backup from Manage WP as well.

Manage WP Optimization

Manual Optimization through phpMyAdmin

If you have access to phpMyAdmin you can use the built in Optimize Table option. Simply select all your tables you would like to optimize and from the dropdown select Optimize table4.

phpMyAdmin Optimize Table

Conclusion

By performing this occasional bit of maintenance an optimizing your WordPress database you’ll keep your site in tip top shape. Let it slide and you may run into bigger problems down the road.

 

  1. It’s me. My first plugin, but it only has one set of options added to the table.
  2. Unless of course you wanted to reinstall it later. In which case, don’t delete the tables.
  3. After backing up your database of course.
  4. After you backed up your database of course.