Post Revision is a WordPress feature that was introduced with WordPress version 2.6. Post revisions allowed WordPress users to go back to previous saved versions of a post. It’s a life-saving feature to those needing to roll back to a previous post.
Although this feature have saved countless individuals from potential lost work, it also can add some overhead to the database tables because it inserts a new record every time a post is saved.
I was more than curious to how much data could be saved if post revisions were deleted from the database. So, I embarked on a project to delete post revisions from my main blog, which happens to be a multi-site blog.
Prior to doing anything, I recommend that you backup your database via PHPMyAdmin. Backup all the tables. This is very important. I can’t stress this enough.
I use the instructions from Lester Chan’s article to turn off and delete post revisions. I didn’t hesitate using Lester’s instructions because he is well-known and trusted member in the WordPress community having written many valuable plugins.
Turn Off Revisions
You can turn off revisions by editing your wp-config.php file and adding the following:
Delete Post Revisions
You can delete post revisions from the wp_posts table by running this SQL statement from PHPMyAdmin. You may need to repeat the process if you have a multi-site blog.
FROM wp_posts a
LEFT JOIN wp_term_relationships b ON (a.ID = b.object_id)
LEFT JOIN wp_postmeta c ON (a.ID = c.post_id)
WHERE a.post_type = 'revision';
I have a total of 5 blogs running on my multi-site blog. Prior to deleting post revisions, my backup SQL file was 16.6MB. After deleting the post revisions, I was able to shave off 2.3MB. The file is now only 14.3MB. It doesn’t seem like a lot of saved space, although it deleted over 1000 rows.
Which brings me to the question, was it all worth it? Probably not. For the tiny amount of space saved, you are probably better off leaving post revisions alone, because you’ll never know if you need to revert to an older post. After all, it’s a nice feature to have.