How to Optimize your WordPress Database
by Frank Jovine on 10/03/2009 in Software
Overhead in one or more of your database tables can cause your database to perform poorly. It can also cause other issues like Fatal Errors. One of the more common fatal errors is memory allocation which can be easily fixed. I will explain a fast way to solve for this issue, but let’s start optimizing.
phpMyAdmin
Here are the steps to follow in phpMyAdmin
1. Go to your web hosting account’s cPanel and click the “phpMyAdmin” icon. If you don’t see one, look for “MySQL Databases” icon, click it, scroll to the bottom of the page, and click the “phpMyAdmin” link.
2. Select your WordPress database.
3. Look in the “Overhead” column. If you see a table with overhead, select that table by clicking on the box to the left.

4. Scroll to the bottom of the page and in the drop down menu select “Optimize Table”.

5. Once the table is optimized, you shouldn’t see any number in the Overhead column. Click the Back button twice (to go back to the tables list), and repeat from step 3 to remove any other tables that have overhead.
How to Fix Fatal error: Allowed memory size
Method 1: You can assign the memory limit to any amount you like by changing the 16M to other number, such as 32M or 64M. 64M will set the memory limit to 64 megabytes.
To change the memory allocation limit permanently for all PHP scripts running on the server, modify the PHP.INI configuration file of the server. Search for memory_limit after opening the file in an editor. If the memory_limit doesn’t exist, add the following line. If it’s there, modify the value of the memory_limit: to;
memory_limit = 64M.
If you do not have access to your PHP.ini file, there’s another method you can try.
Method 2: Add the following to wp-config.php right before the ‘stop editing’ comment:
ini_set(“memory_limit”,”64M”);
I have tested this in WordPress 2.8.4 and it worked like a charm.





Jonathan - Advanced Life Skills
Oct 3rd, 2009
Frank, How do you know if you need to do this?
Frank J
Oct 3rd, 2009
Jonathan,
Just check inside your phpadmin to see if any tables have overhead.
Gadget Sleuth
Oct 3rd, 2009
I wish people would look for articles like this before asking (whining most often) for help (comes from a current web hosting tech).
BunnygotBlog
Oct 3rd, 2009
I thought WordPress was already handling 80% of the mechanics with optimization.
Frank J
Oct 3rd, 2009
Bunny,
Well than here’s the 20% it’s not handling.
Ann Arbor Computer Repair
Oct 3rd, 2009
Good topic, I was just thinking about doing something to this effect the other day. Thanks for the tips.
Frank J
Oct 4th, 2009
Glad we could shed some light and help others to speed up and reduce database overhead.
Flashback Monday - Income Report And Review
Oct 9th, 2009
[...] 10 Tips To Make More Money with Sponsored Tweets Blog Visitors, Readers, Commenters and Subscribers How to Optimize your WordPress Database Heres Your Chance to be a Writer For a Day! Why Do You Write? Don’t Ask Me To Leave Comment [...]
Harsh Agrawal
Oct 9th, 2009
Simple trick and it works big time, though I use a wordpress plugin name as wp-db manager plugin which does the same from the wordpress dashbaord.. I hate opening phpmyadmin all the time…
Frank J
Oct 9th, 2009
Harsh,
I would like to see instructions and a screen shot on how users can Optimize WP in wp-db.