As per this question over on DBA.SE, I’m having quite a few issues with database optimisation.
I’m just wondering if removing/disabling revisions will positively impact my database usage? We don’t seem to use them as often as I was expecting.
Currently I’ve got it set so that each post can have up to 3 revisions.
If removing these will improve performance, what’s the “up to date” way of removing revisions from the database?
Thanks in advance,
And sometime later they did turn it on, and WordPress.com now stores the last 25 revisions for each post on a blog. So, yeah, you can deal with revisions.
The problem with post revisions is that your database size can grow really big (depending on the number of revisions created) and it in turn adds to MySQL’s processing burden.
Nevertheless, you can deal with it. Enable page and database-level caching â W3 Total Cache does this, and if your website is served from a single server, try WP Super Cache. And then there are various web application accelerators like Varnish cache. Websites with tens of thousands of posts have to do sharding, slave and master replication of database and stuff anyway.
Even then, revisions on (very?) old posts is a waste of resources, IMO. As for me, I delete revisions of published posts from time to time (every 2-3 days).
Deleting Revisions:
Backup, backup, backup first. Always!
If you want to use a plugin to delete revisions and optimize database, and keep things simple, try Better Delete Revisions. You might also want to take a look at Revision Control.
Or you can do it manually using SQL as shown below.
(1A) Delete revisions of all posts and pages on your WordPress blog (source):
(1B) If you use the Links feature in WordPress (Blogroll, etc), DON’T use the aforementioned SQL query. Use this instead (read why?):
(2) Delete auto-drafts:
(3) Optimize your database tables:
NOTE: In the SQL queries listed above, don’t forget to replace
wp_
with your database table prefix.