WordPress Database Junk
WordPress Database Contains a Lot of Junk
WordPress stores a lot of junk in the database. WordPress news feeds, theme and plugin update release notices and information, old plugin and theme stuff from removed plugins and themes that don’t clean out their data; and that’s before getting to the useful junk like post revisions and other data useful to WordPress users.
Storing junk in the database is nothing new to WordPress, as a .org support submission from 4 years ago shows.
I noticed my WordPress database was excessive in size, found it padded with 7,000 lines of WordPress “news.” Why is this stuff in my database, and how do I get it out? wordpress.org/support/topic/database-padded-with-junk-content
Interestingly, no-one bothered to reply to the submission.
Unnecessary Data Stored in Database
All the WordPress news, theme and plugin news and information is hardly needed for WordPress. Storing this junk in the database only makes admin pages load faster – to the detriment of the live (public) website. While the news and info is interesting, instead of being stored in the WordPress database, it could be browser cached locally.
There’s no need at all store plugin instructions and such in the database – loading simple text files “on-demand” is good enough; OK, then the Java powered tool-tips, and other admin stuff that makes WordPress a pleasure to use, won’t work, so maybe a rational approach is needed – store only essential data needed on-the-fly by users in the database, leave the padding out completely.
From 7MB to 4MB with Database Junk Removed
I’ve been working on a hacked site the last few weeks; trawling a database backup for SQL injections, looking for any remaining backdoor code, recovering some lost content (We had to use a month old backup to get the site back online in the shortest time).
7MB of plain text data is a big file – about 1900 A4 size pages of plain text. As the inspection progressed, and checked data got deleted, the file got smaller until eventually we had a 4MB file. We’d worked from the top down – all the database junk so far deleted was in the top of the file, before any site structure and content. That’s 3MB of rubbish, nearly half the size of the database.
1.5 MB of Content Data
Further removal of post revisions, captured 404’s, 404 redirects, and the structure data (menus and so on) left a 1.5 MB file of published content data, which was much easier to use for recreating the lost content.
Cleaning the Database.
There are several plugins to clean up the WordPress database, as well as more technical ways using SQL Queries. These tools should be used regularly to get rid of stuff you don’t need; old post revisions, removed plugin database table entries, old captured 404’s.
Here’s some of these plugins
What these plugins won’t do is remove the junk! There is no plugin to clean out the news and other junk information stored in the database. Cleaning this out is manual process – with all the dangers of breaking the database completely. And even if you succed in clearing out the rubbish – it will start coming back, every time you access wp-admin, install a plugin or theme update, add a new theme or plugin…