Page 2: How to Maintain a WordPress Database

Lester Chan comes through yet again with the “WP-DBManager WordPress plugin to manage your WordPress database. Once you install and enable the plugin you’ll find that in your dashboard you now have Write, Manage, Design, Comments, and “Database”. The first thing I look for is excessive “overhead”. Just past your database information is a section labeled “Tables Infomation”. You’re looking for any tables that (in the rightmost column) have “overhead”.

database tables information

What is database overhead? First I’ll give you the technical answer, then I’ll explain: “OPTIMIZE TABLE should be used if you have deleted a large part of a table or if you have made many changes to a table with variable-length rows (tables that have VARCHAR, VARBINARY, BLOB, or TEXT columns). Deleted rows are maintained in a linked list and subsequent INSERT operations reuse old row positions. You can use OPTIMIZE TABLE to reclaim the unused space and to defragment the data file.”

Basically a table in a database is kind of like a spreadsheet that stores information. That infomation is stored in “rows”, and over time rows are edited and deleted. When that happens “overhead” occurs, and the table isn’t as efficient. You know how you have to defragment a hard drive? Well, “optimizing” a database table is like that. So if you have some db table “overhead” it’s time to optimize the table. Even if you have no overhead, you should do this once or twice per month.

How do you “optimize” a wordpress database? Just click on the “Optimize” tab at top of the “Database” screen in your WordPress dashboard (that you have since installing the WP-DBManager plugin), and then at the bottom of the page click “optimize” again. You should get a page that looks something like this after optimizing with a success message at the top:

Optimizing wordpress database

If for some reason when you optimize your database there is an error of any kind, then you can click on “Repair database” to see if it can be fixed. It works the exact same way, and when complete will tell you whether it was successful or not. Again – you should optimize your wordpress database once per month at minimum, and more often if your blog is very busy. In the next step, you’ll learn how to automatically do this.