Blog / WordPress /

WordPress revisions, autosaves and database bloat

A WordPress post that has been edited forty times exists, in a sense, forty-one times. Every save creates a revision, and WordPress keeps all of them by default. Multiply that across a few hundred posts and pages, add years of plugins coming and going, and the database ends up much bigger than the content it holds.

Is that a problem? Sometimes. Usually less than the “speed up WordPress” articles suggest, but now and then it’s exactly why the admin feels sluggish or backups take forever.

The short answer: limit revisions going forward, clean up old ones and leftover plugin data once in a while, and look at autoloaded options if the site feels slow. Take a backup before any of it.

What revisions and autosaves are

Revisions

Each time you click “Save draft” or “Update”, WordPress stores the previous version as a revision in the wp_posts table. You can compare and restore them from the editor’s Revisions panel. That’s genuinely useful when someone deletes a paragraph they needed.

By default there’s no limit. A post edited a hundred times has a hundred revisions.

Autosaves

While you’re editing, WordPress autosaves every 60 seconds or so. It keeps one autosave per user per post, overwritten each time, so autosaves don’t pile up the way revisions do. They’re mostly harmless.

Do revisions slow your site down?

For visitors, rarely. WordPress queries for published posts, and revisions are stored with their own post type, so a well-indexed database skips over them. A few thousand revisions on a normal site won’t change page speed noticeably.

Where bloat does hurt:

  • Backups and migrations get slower and larger.
  • Admin screens and searches can drag on very large databases.
  • Cheap hosting with tight database limits can start to complain.
  • Some plugins run heavy queries across all posts, including revisions.

So treat this as housekeeping, not a magic speed fix. If a site is slow for visitors, the usual causes are elsewhere: hosting, images, too many scripts. I went through those in how to speed up a WordPress site without breaking it.

The bloat that matters more than revisions

Autoloaded options

The wp_options table holds settings, and many rows are marked to autoload: WordPress loads them on every single page request. Plugins that store large chunks of data there, or that you deleted without them cleaning up, can leave megabytes being loaded every time.

This is the one I’d check first on a slow site. Site Health (Tools → Site Health) in recent WordPress versions warns when autoloaded options get large. A database tool or a query can show you the biggest rows and which plugin they belong to.

Expired transients

Transients are temporary cached data. They’re supposed to expire, but expired ones aren’t always cleared from the database promptly. Clearing them is safe; anything still needed gets recreated.

Leftovers from removed plugins

Many plugins leave their tables and options behind when you delete them. Old SEO plugins, page builders and security tools are common offenders. If you’ve ever switched SEO plugins, there may be a full set of the old one’s tables still sitting there.

Spam and trashed comments, trashed posts

Small individually, but on a site that gets a lot of spam they add up.

How to limit revisions going forward

Add one line to wp-config.php, above the “That’s all, stop editing” comment:

define( 'WP_POST_REVISIONS', 10 );

That keeps the ten most recent revisions per post. Older ones are removed as new ones are created. I wouldn’t set it to false (no revisions at all). Five to ten gives you a safety net without the pile-up.

You can also lengthen the autosave interval, though there’s rarely a reason to:

define( 'AUTOSAVE_INTERVAL', 120 ); // seconds

Some hosts and performance plugins offer the same settings without editing files.

How to clean up what’s already there

Step 1: back up the database

Not optional. A cleanup tool that deletes the wrong rows can’t be undone without one. If you need a backup setup, start with WordPress backups: a setup that saves you on the worst day.

Step 2: pick one method

  • A cleanup plugin. Several well-known ones remove revisions, transients, spam and trash with a few clicks, and some can schedule it. Install, clean, and consider removing it afterwards if you don’t need it running. (Every plugin is one more thing to maintain, as I argued in how many plugins is too many.)
  • WP-CLI, if your host offers it. For example, to delete all revisions:
wp post delete $(wp post list --post_type='revision' --format=ids) --force

and to clear expired transients:

wp transient delete --expired
  • Your host’s tools. Some managed hosts include database optimisation in their dashboard.

Step 3: leave leftover tables until you’re sure

Deleting tables from old plugins is where people break things. Check the table prefix belongs to a plugin you’ve genuinely removed, and that nothing active uses it. When in doubt, leave it. A few unused tables cost little.

Step 4: optimise the tables

After deleting lots of rows, “optimising” the tables (most cleanup plugins and phpMyAdmin can do it) reclaims the space.

How often to do this

For most sites, once or twice a year is plenty. Put it in the maintenance routine alongside plugin audits, and you’ll never have to do a big, scary cleanup. It’s on my list in a WordPress maintenance checklist for site owners.

FAQ

Will deleting revisions affect SEO?

No. Revisions are never shown to visitors or search engines. Deleting them only removes the ability to restore older versions in the editor.

Should I delete revisions on a site with many editors?

Keep a sensible limit rather than none. On sites with several editors, revisions are how you find out who changed what, and how you undo it.

Open Tools → Site Health on your site today and see whether it mentions autoloaded options. If it does, that’s your first cleanup job, and a better use of the time than counting revisions.