Over the past few days, as I have been increasingly active in “fixing” PersonalLog, I noticed something that’s always been perplexing to me. Our database had been increasing significantly in size, and it was rather odd.
I decided to use phpMyAdmin to take a look. What I found was disturbing. (No screenshots.)
The database had over 4000 records in the options table for many blogs. Looking through some of the records, I quickly ascertained that most of the records were duplicate entries: “kb_robotstxt” and the robots.txt file as the value.
I immediately proceeded to wipe the 4000+ records from the tables, which ended up halving the size of the database after optimization. I then went over to the File Manager for a bit more investigation.
The problem was clearly the “KB Robots.txt” plugin. After checking the plugin’s PHP file, I was shocked to see an ugly piece of code that inserted a database record for the plugin’s options every time it was loaded. Since WordPress plugins are loaded on every page load, this meant that the plugin was inserting a new record into the table for every page load, unnecessarily.
I know I could have changed the plugin so that it only did so upon activation. But I was so disturbed by this piece of bad coding that I proceeded to delete it immediately.
As a result, all blogs depending on the “KB Robots.txt” plugin will no longer have access to it. Instead, I did something that was better; I made a default, search engine optimized robots.txt file identical to what the plugin produced, so all blogs will now benefit from the robots.txt optimization, without the need for an inefficient plugin.
Addendum: the database has been further optimized by purging the caches of the various RSS feeds in the dashboard. This means that the first time you log in to your dashboard after these changes, there will be a slight delay (both before and after you load the page) while WordPress fetches the RSS feeds. However, the database is now a fifth of its unoptimized size and will perform significantly more efficiently.
Enjoy your blogs on a cleaner, faster database.