Every WordPress database grows. Each edit leaves a revision, each plugin you try leaves options and sometimes whole tables behind, and caches pile up and never leave. After a few years, a site with 200 posts can carry a database of several hundred megabytes. Here is how to clean it up safely, and what is actually worth cleaning.
In 30 seconds
- Back up first. Deletions in the database are permanent.
- Start with the safe leftovers: revisions, auto-drafts, trash, spam comments and expired transients.
- The real weight is often elsewhere: tables and options left by plugins you removed, and big autoloaded options.
- Measure before you delete: look at the size of each table, and who created it.
- I made Database Cleaner for this. The free version measures and cleans; Pro names the plugin behind each leftover and can clean on a schedule.
What fills up a WordPress database
Most of it is not your content. Your posts and pages are usually a small part of the database. The rest is history and leftovers:
- Revisions: WordPress keeps a copy of a post every time you save it. A post edited 60 times has 60 copies.
- Auto-drafts and trash: drafts WordPress started for you, and posts you deleted. Trash empties itself after 30 days by default.
- Spam and unapproved comments: often thousands of rows on an old blog.
- Transients: temporary caches plugins store in the options table. Expired ones should disappear, but many stay.
- Orphaned metadata: extra data attached to posts, terms or comments that no longer exist.
- Leftovers from removed plugins: tables and options that stay after you delete the plugin. This is often the biggest part.
Before anything: a backup
I say it in every guide, and I mean it most here. A file can be restored from the trash; a deleted row can’t. Make a fresh backup of the database (your host probably has a one-click backup, or use your backup plugin), and check that it actually exists before you start.
Step 1: measure first
Don’t clean blind. Look at the size of each table first. If one table holds 80% of the database, that is where the gain is, and deleting revisions won’t change much. In Database Cleaner, the Tables view sorts every table by size, and shows which ones belong to WordPress and which don’t.

Step 2: clean the safe leftovers
Revisions, auto-drafts, trashed posts, spam and unapproved comments, expired transients, orphaned metadata and old oEmbed caches can go without a second thought on almost every site. In Database Cleaner this is the Easy mode: pick the categories, look at the counts, clean. It works in small batches, so even a very large database is cleaned without timeouts.
To keep revisions from piling up again, you can limit them in wp-config.php: define( 'WP_POST_REVISIONS', 5 ); keeps the last five for each post.
Step 3: the leftovers of old plugins
This is where most of the weight hides, and where you need to be careful. A table named wp_xyz_logs could belong to a plugin you removed two years ago, or to one that is still running. Before deleting a table or an option, find out who created it.
Database Cleaner’s Expert mode lists every table, option, post type and cron job, and flags the ones no active plugin seems to use. The Pro version goes further and names the plugin or theme behind each one, so you know exactly what you are deleting.
Step 4: check the autoloaded options
Some options are loaded on every single page of your site, whether they are needed or not. A few big ones (old caches, logs saved as options) can slow everything down. The Options view shows how much is autoloaded; for a large option that isn’t needed on every page, you can switch its autoload off instead of deleting it.

Keep it clean
A clean database doesn’t stay clean. With Pro, the categories you approved run on a schedule, so the clutter never comes back. Scheduled tasks rely on WP-Cron, so make sure WP-Cron runs reliably on your site.
And if you use AI Engine, its MCP server lets Claude or ChatGPT inspect the database with Database Cleaner’s tools: what is big, what looks unused, what is safe to remove. You stay in the loop for every deletion.
The files deserve the same care as the rows: find and delete unused images with Media Cleaner. Comparing tools? Here is an honest look at Database Cleaner vs Advanced Database Cleaner.
Questions people ask
Is it safe to clean the WordPress database? Yes, if you back up first and start with the safe categories: revisions, auto-drafts, trash, spam and expired transients. Deletions in the database are permanent, so a fresh backup is your undo button.
How often should I clean it? For most sites, a few times a year is plenty. A busy store or a site with heavy editing can do the safe categories every week, automatically.
Will cleaning the database make my site faster? Sometimes a lot, often a little. The biggest wins come from large autoloaded options and huge leftover tables, not from deleting a few hundred revisions.
Can I delete the tables of a plugin I removed? Yes, once you are sure the plugin is gone for good and nothing else uses them. Check who created the table first, and keep the backup.
Should I use phpMyAdmin instead? Only if you know exactly what each table and option does. A dedicated tool shows the same data with names and categories, and won’t let a typo drop the wrong table.
Back up, measure, clean the safe things first, and take your time with the rest. Your database will thank you. 😺