How to reduce MySQL Database size by managing WordPress Post Revisions count (WordPress Tip for Optimum Performance)

Description

The WordPress revisions system stores a record of each saved draft or published update. The revision system allows you to see what changes were made in each revision by dragging a slider (or using the Next/Previous buttons). The display indicates what has changed in each revision – what was added, what remained unchanged, and what was removed. Lines added or removed are highlighted, and individual character changes get additional highlighting. Click the ‘Restore This Revision’ button to restore a revision.

 
Introduction to feature called revisions

As stated above ‘Revisions’ are post’s stored drafts for future proof reading of blog post. It creates multiple copies of blog post you are working on in your MySQL Database in plain english. So it naturally affects & increases size of your WordPress’s MySQL Database size in megabytes

 
Suggestion

So I would suggest to use following code to successfully control WordPress Post Revision Count to ultimate ‘3’ to stop it growing above & create clutter of your WordPress Database.

 
Specification

Put Following code to your WordPress’s Installation’s wp-config.php file to limit the number of posts revisions that WordPress stores in the database. Old revisions are automatically deleted.

/* Limit the number of posts revisions that WordPress stores in the database */
define( 'WP_POST_REVISIONS', 3 );

 
Note: After pasting above code in your installation’s wp-config.php file then navigate to your website’s MySQL Database’s phpMyAdmin portal then select all your tables of your selected database & select ‘Optimise’ in drop down below.

 
Advantage

As I have used this code in my own websites to successfully reduce my WordPress’s Installation MySQL Database size by 50% to 60% i.e by almost 5 mb

 
Further Reading: http://codex.wordpress.org/Revisions

 
Hope this helps,

 
Thanks & Regards
Mandar Apte

Leave a Reply

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