Gospel. Culture. Technology. Music.


The Annoyance of WordPress Revisions – And the Fix

After getting this new blog up and running, I noticed one of the features that was added in version 2.5 of WordPress: revisions. It got me to thinking about how the database was impacted after moving all of those entries over. After running a query in the DB, the result came back with 1723 rows, yet I only have 684 entries. The rest (minus pages and attachments) were all revisions of blog posts and pages. Each revision is a full blog entry. Over time, that could add up to a lot of data, depending on how often you post entries and how many revisions you create in the process of each post.

First of all, it’s super easy to turn off revisions in WordPress 2.7. Just open the file wp-settings.php. In the code, look for the line below:

$default_constants = array( ‘WP_POST_REVISIONS’ => true );

Change the “true” to “false” and save the file. Okay that was simple and will keep revisions from being utilized. But what about the revisions that still exist in the database? That’s a little more involved. REMEMBER, before you do this, backup your MySQL DB first so you can easily restore it just in case you take out the whole thing by accident.

Since I run MySQL on a Windows machine (I know, go ahead and laugh) open up the MySQL query browser from Programs on the Start Menu. Then run the query below to take out all the revision entries of both posts and pages:

delete from wp_posts where post_type = ‘revision’;

That will do it.

Previous

Is anything too hard for the Lord?

Next

WordPress, User IP’s and Reverse Proxies

2 Comments

  1. Rory Baker

    Ha ha, Windows! I prefer to refer to it as Micro$loth Win-blows.

    Yeah, right. I kicked my girlfriend out, and I’m about to reboot in to WinXP so I can play Left 4 Dead and Team Fortress 2 in all it’s splendor.

    How much space does a “revision” take up? What’s the impact on performance?

    Also, I don’t know if I showed you: http://forums.gentoo.org/viewtopic-t-717117-highlight-firefox.html

    Basically, they mount the user’s Firefox profile directory on to a RAM disk. I wonder, given sufficient RAM, if that might help speed up a particular process or server.

    FYI, everything seems pretty responsive from an end-users perspective, especially considering I’ve got Bittorrent running full blast, and a number of Firefox addons and Greasemonkey scripts clawing at everything.

    • Very nice. A revision is basically just an earlier version of a blog entry. I’m not sure how the revisions affect performance, but the search function sure does seem faster now. But it could just be my imagination and a bit of mental projection.

      Yeah, this site is a much quicker platform … it’s not having to pull entries off a flat file on the web servers’ disk anymore. In addition, I’m running eAccelerator for PHP (caches PHP scripts in memory so it’s not hitting the disk over and over), MySQL query caching, front-end reverse proxy gzip compression, ModSecurity web firewall, and no back-end server tweaks to slow things down. All this greatly speeds things up, even over a DSL connection and keeps the site free of automated crapola. And on top of that, your browser hacks are probably helping too.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Powered by WordPress & Theme by Anders Norén