Removing revision from WordPress database

Sometimes when moving a WordPress blog the best option is to export the database and then import it at the new location. When doing it this way, instead of just exporting and importing the content, you move everything – not just the content. Your plugins configurations, your settings and so on and so an are all included in the move.

The other day was my first time moving a WordPress install the database way, and even though it is seemingly straight forward I met some challenges on the way.

The database dump was to large

When importing the database phpMyAdmin kept timing out and only part of the database got imported. The size of my database dump was 12.4 MB and therefore well below the stated limit of 500 MiB. However I was not in the mood to talk to support and after some research I found out that my database dump consisted mostly of revisions.

After getting rid of the revisions the database dump size was down to 3.2 MB and the import went through without a glitch.

Solution: Remove the revisions from the database

I found the solution in this blog post, and used the query option:

[code language="sql"]
 DELETE FROM `wp_posts` WHERE `post_type` = 'revision';
 [/code]

Hope this can be of use!

Leave a Reply