How to Clean Up Your WordPress Database for Improved Performance


If you have been using WordPress for a while, then there is a good chance that you need to clean up your WordPress site. Doing regular clean ups allow you to reduce your database size which means quicker and smaller backup files. In this article, we will show you how to clean up WordPress database.

Cleaning up WordPress Database

As you use WordPress, your database accumulates a lot of extra data such as revisions, spam comments, trashed comments, data from plugins you are no longer using, and more. Removing all this unnecessary data can significantly reduce your database size which speeds up your backup process and can add minor performance improvements as well.

Let’s take a look at how you can clean up your WordPress database.

Before you start, Make a Backup!

Before you do anything else, first create a complete WordPress backup of your site. Changes made by the clean up plugin are irreversible. Even though it does not directly mess with your posts or comments, its always better to be safe than sorry.

Video Tutorial

Subscribe to WPBeginner

If you don’t like the video or need more instructions, then continue reading.

Cleaning up your WordPress Database with WP-Sweep

First thing you need to do is install and activate the WP-Sweep plugin. Upon activation, simply go to Tools » Sweep to clean up your WordPress database.

WP-Sweep posts analysis

This plugin will analyze your WordPress database and show you a report of how much clutter you can clean. The sweep report is divided into different sections for your posts, comments, user meta, options, terms, and database optimize.

Cleaning up your comment meta and user meta data

You can go through items and clean them individually, or you can scroll down to the bottom of the page and click sweep all to clean up everything in your WordPress database.

Cleaning up may take some time depending on how big your database is. WP-Sweep will show you the progress by updating the stats on the page.

Why WP-Sweep vs WP-Optimize?

You may be wondering why are we writing about WP-Sweep when there is a very popular WP-Optimize plugin available that does nearly the same thing.

Well that’s because it’s coded by a well-respected WordPress developer, Lester Chan.

Also because the main distinguishing characteristic of WP-Sweep is that it uses proper WordPress delete functions as much as possible instead of running direct delete MySQL queries. Whereas the WP-Optimize plugin uses direct delete SQL queries which can leave orphaned data left behind.

In other words, WP-Sweep is a better coded plugin than WP-Optimize.

What all does WP-Sweep clean?

WP-Sweep uses all the proper WordPress delete functions to clean up the database. At the time of writing this article, it can clean up the following:

  • Revisions
  • Auto drafts
  • Deleted comments
  • Unapproved comments
  • Spammed comments
  • Deleted comments
  • Orphaned post meta
  • Orphaned comment meta
  • Orphaned user meta
  • Orphan term relationships
  • Unused terms
  • Duplicated post meta
  • Duplicated comment meta
  • Duplicated user meta
  • Transient options
  • Optimizes database tables
  • oEmbed caches in post meta

That’s all, we hope this article helped you clean your WordPress site using WP-Sweep. You may also want to check out our guide on the most common WordPress errors and how to fix them.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Google+.

Seraphinite AcceleratorOptimized by Seraphinite Accelerator
Turns on site high speed to be attractive for people and search engines.