I have WordPress setup to automatically create a GZIP’d database backup and email it to me every week, and I’ve noticed the size was creeping up past 2MB. I decided to poke around and find out why the size was getting so large even without many posts or comments and I found some very special stuff!

To start with, some plugins – which had no business adding tables to the database – were doing just that! I had several tables, most of which were empty, created by plugins that I was testing out at one point or another. It’s not a lot to have one empty table take up 4.0KB in a database, but when you have 16 empty and another 7 with stuff in them from deleted plugins, it adds up. I had over 200KB of wasted space just in useless tables.

Not to mention the tables that were once useful, but are no longer necessary since the plugin that used them has been deleted. I had Statpress Reloaded installed for a few months and decided that it wasn’t important enough for me to keep, so I deleted it. Unfortunately, it didn’t take its table with it, so I was left with 3.3MB of data with nothing to utilize it.

And then there was the data left in the usermeta table which contained all information on “registered” users, even though they had been deleted from the users table. I cleared data for 526 user_ids which were no longer valid and freed nearly 450KB of space.

Right now, I’m working on clearing out the options table, but I think the space saved here will be minimal since the entire table is only 436KB to start. After only clearing out the previous items and doing a Repair/Optimize on all tables in the DB, my new GZIP’d backup is only 371KB! I think it was worth the effort to tidy things up.