How to optimize your WordPress database

Female entrepreneur working on laptop computer with business chart on screen, top view

Websites are constantly evolving and getting more complex, and the database is at the center of it. In this post, we’re covering how to optimize your WordPress database, and how to automate the process.

Why do you need to optimize your database?

Your website’s database holds all the critical data to operate the website and must be optimized on a regular basis to keep your website running fast and smoothly.

This task is super important if you’re running an e-commerce store with client data and products for sale.


While you can optimize your database manually, the simpler solution is to use an optimization plugin such as SG Optimizer or WP-Optimize.

I’m currently using SG Optimizer, so I will focus on it for this post, but WP-Optimize has similar features.

Automated database maintenance

SG Optimizer allows you to optimize the database on a weekly basis automatically; just make sure you enable scheduled database maintenance, and the plugin will do the following tasks each week.

  • Perform Database Optimization for MyISAM tables
  • Delete all automatically created post and page drafts
  • Delete all page and post revisions
  • Delete all posts and pages in your Trash
  • Delete all comments marked as Spam
  • Delete all expired Transients

Note: SG Optimizer is designed to link WordPress with the SiteGround Performance services, and will not work with other hosting providers.

Are you optimizing your database?