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.
Frank, How do you know if you need to do this?
Jonathan,
Just check inside your phpadmin to see if any tables have overhead.
I wish people would look for articles like this before asking (whining most often) for help (comes from a current web hosting tech).
I thought WordPress was already handling 80% of the mechanics with optimization.
Bunny,
Well than here’s the 20% it’s not handling. :)
Good topic, I was just thinking about doing something to this effect the other day. Thanks for the tips.
Glad we could shed some light and help others to speed up and reduce database overhead.
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…
Harsh,
I would like to see instructions and a screen shot on how users can Optimize WP in wp-db.