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 essential 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 because it works on any hosting environment, 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; make sure you enable scheduled database maintenance, and the plugin will do the following weekly tasks.

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

Are you optimizing your database?

Check out 3 key benefits of updating your website, and What Is WordPress Maintenance and How to Make It Easy for additional tips.

Picture of Mario Seijo

Mario Seijo

Creative Director - focused on helping underserved entrepreneurs launch and optimize their websites.