Save more WordPress’ database disk space with a simple trick

If you use WordPress as blogging platform, and you have installed a recent version, you must have see that it has become more greedy in space.

This is particularly due to the registration of “revisions”.

What is “revisions”?
These are versions of posts that are recorded as you write. This is a very useful feature when writing a post several times, not to lose content that might have cleared.

However this feature is greedy and take a huge disk space on the database because each revision takes roughly as much space as the post finally published.

Personally I use the revisions until the final publication. But after this stage, I do not need them. I wanted to find a way to remove them to optimize my database.

mysql improve wordpress

This is very simple: a single line of SQL will make a nice cleaning. The “revisions” have a type associated in a field in the table posts.

DELETE FROM wp_posts
WHERE post_type = ‘revision’;

Just execute this directive in the administration interface of your database such as PHPMyAdmin. Doing so will reduce your database disk space.

If you do not want to clean up all, but only posts written before a certain date, you can use to that :

DELETE FROM wp_posts
WHERE post_type = “revision”
AND post_date < “20013-01-01“;

Change the date above to what suit your need.

You May Also Like

Why WORDPRESS is better?

You might have started your own online business. Well, to make it work, you need to own a site. However, if you do not know much about programming languages, then it would benefit you a lot to make use of the simple and easy ones. In this matter, it would be a very good idea […]

Can Ghost, the new comer win a significant market share?

For some years now, WordPress (WP) has established itself in the blogging world, as the leader in web content creation and management. Born in 2003, the software which is used with PHP has won a multitude of bloggers. It certainly takes some knowledge in the field of computer science to use WordPress properly. But, past […]

Use the RSS feed for a specific category

If you want to encourage your readers to subscribe to some of the updates of your site, it may be interesting to set up RSS feeds by category. The feed url to track updates on a category is obtained very simply by getting the URL of your category and add this /feed after the link they […]

Exclude the category you don’t need from your menu

Every time you add a new theme to your WordPress blog and you find that this theme show all your categories in a menu. The idea of excluding a category from the menu come directly to your mind. Today I propose to change the categories menu you have in your home page to suit your […]