Is Your WordPress Database Too Large? Thin Out Revisions

A great feature of WordPress is its ability to save different versions of your posts as you go -- such as when you hit the "save draft" or "preview" buttons. These saved versions are called "revisions," and they give you restore points if anything goes wrong.

Awesome, right? Well, it can be. But WordPress revisions have to be saved to your database just like your current post drafts do. And because WordPress can end up saving a dozen or more revisions for a post, your database might be much larger than you think. So for this week's quick tip, let's look some ways you can fix and prevent this problem.

Who Cares if the WordPress Database Gets Too Big?

A WordPress database that's unnecessarily large can cause several problems.

For example:

  • Backups take up more space (especially if you like to save several backups at any given time instead of just the latest).
  • Importing large databases can cause problems with the setup of some hosting accounts.
  • Your site can run more slowly when you have a large database.
  • A large WordPress database could cause you to exceed limits placed by your host (such as CPU or memory limits). This is a bigger problem with shared hosts where they often advertise "unlimited" services without being transparent about their true resource limits (they all have them).

What Can You do About a Large WordPress Database?

One way you can deal with this issue is to prevent WordPress from saving an unruly number of revisions in the first place. To do that, you'll need to open your wp-config.php file. You can find it in the top level of your WordPress installation on your server.

Prevent WordPress From Saving Too Many Revisions

You'll want to add the following line to limit your number of revisions per post (changing "5" to whatever number you want -- I recommend at least four).

define( 'WP_POST_REVISIONS', 5 );

If you aren't worried about keeping revisions for whatever reason, you can turn them off entirely by adding this to wp-config.php instead:

define( 'WP_POST_REVISIONS', false );

Add either of these right above the line that says "That's all, stop editing! Happy blogging."

You can learn more about controlling future post revisions in the WordPress Codex.

Remove Existing Revisions From Your WordPress Database

Those solutions are great if you have a new WordPress installation or if you want to limit revisions in the future. But what if you already have hundreds (or thousands) of posts, with a lot of revisions saved for each, in your database?

That's where plugins come in handy. Specifically, I use one called Thin Out Revisions. This allows you to remove old revisions that you no longer need. For example, you can have it remove any revisions older than 30, 60, or 90 days (assuming if you haven't needed to restore in that time period, you probably never will, or could from a backup). You can even have this automatically run so it clears out revisions on a regular basis.

Another option is to have the plugin delete all revisions when you first publish a post. That can come in handy if you write directly in WordPress (which I don't recommend, but which I'm also still guilty of from time to time). Writing in WordPress can lead to a lot of auto-saves with unfinished content as you use the preview feature, so it makes sense to delete them once you have a version ready for publication.

When was the last time you thinned unnecessary post revisions from your database? Give it a try if you're worried that your database might be bloated. But of course, back up your original first just to be safe.

Do you use other tools for managing WordPress revisions? Tell us about them in the comments.

Profile image for Jennifer Mattern

Jennifer Mattern is a professional blogger, freelance business writer, consultant, and indie author. She runs numerous websites & blogs including All Freelance Writing, Freelance Writing Pros, NakedPR, and Kiss My Biz.

Jenn has 25 years' experience as a professional writer and editor and over 20 years' experience in marketing and PR (working heavily in digital PR, online marketing, social media, SEO, new media, and thought leadership publication). She also has 19 years' professional blogging and web publishing experience (including web development) and around 18 years of experience as an indie author / publisher.

Jenn also writes fiction under multiple pen names and is an Active member of the Horror Writers Association.

Subscribe to the All Freelance Writing newsletter to get freelance writing updates from Jenn in your inbox.

Get More Content Like This in Your Inbox

Did you enjoy this post? If so, please subscribe to the All Freelance Writing newsletter where you'll be notified of new blog articles and receive subscribers-only content.

Subscribe now.

6 thoughts on “Is Your WordPress Database Too Large? Thin Out Revisions”

  1. Hi Jenn: I use the plugin WP-Optimize. It gives you the option to clean up post revisions, auto draft posts & posts in trash, spam comments & spam in trash, and unapproved comments, as well as other options like transient options, pingbacks and trackbacks.

    You can schedule clean-ups. Right now I clean up the 1st group I listed after each post. So far I’ve been too lazy to automate. 😉

    • I saw a few reviews for that one when I searched for the download page for Thin Out Revisions. I haven’t tried it yet, but I might take a look one some smaller sites. 🙂 Fortunately I never have to worry about spam comments b/c my anti-spam plugin blocks automated spam before it can even get to the spam folder (so much better than Akismet!). So beyond revisions, I’m not sure I’d need any of the other features.

  2. Hello Jennifer,

    Thank you for introducing my plugin 🙂
    I’d just like to add to your post that Thin Out Revisions’ features are not only on your setting screen but also on the Edit Post page and the Revision Comparison page. Deleting arbitrary revisions, adding a memo to each revision, showing the memos on the post. These features are also helpful for writers and I hope you would like it.

    • Great additional information. 🙂 Manual deletions are definitely an important feature. And while I haven’t used the memo feature yet, that could be a great way of documenting revisions you know you want to keep so they’re not accidentally deleted. Thanks for sharing! 🙂

  3. Thanks Jenn — I’m really careless about revisions, and I do write in the WordPress editor, sort of. I write in Markdown, convert to HTML, and paste it in. But I’m forever fiddling, so there are lots of versions of each post.

    I’ve just installed Thin Out Revisions; it looks brilliant. Will tweet and pin…


Leave a Comment