Top 3 Ways to Optimize Your WordPress Site’s Database

If you are an experienced blogger or internet marketer then you must have heard that website speed is extremely important as far as search engine optimization is concerned. Google wants to offer the best possible user experience to their searchers and the loading speed of your pages is an integral part of that experience. Therefore if you want your website to rise in SERPs then you should try your best to make it fast and responsive.

There are several optimization methods popular among WP bloggers but one method is often ignored which is database optimization. By getting rid of unneeded rows from your website’s MySQL database you’ll be able to improve performance considerably.

Here are the top 3 ways to optimize your WordPress site’s database:

1. Cleanup in PHPMyAdmin

PhpMyAdmin is an excellent system for those who are not well-versed in SQL. It provides a very easy GUI using which even novice users can run queries and perform necessary optimization tasks. However this system is not provided by all hosting providers.

If your hosting server does have phpMyAdmin installed on it, simply log into it to start optimizing your tables. If you don’t remember the username and password you can find it in wp-config.php. First of all, select a database from the panel on the left. Then, from the tabs on the top click ‘SQL’. You will see a query box on the screen. Just put any valid SQL query in the box and hit go to execute it.

Here are some queries that you can run to clean up your database:


DELETE FROM wp_posts WHERE post_type = ‘revision’


DELETE FROM wp_posts WHERE post_status = ‘auto-draft’

Orphan Post Meta

DELETE FROM wp_postmeta WHERE post_id NOT IN (SELECT ID FROM wp_posts)

Spam Comments

DELETE FROM wp_comments WHERE comment_approved = ‘spam’

Alternatively you can browse through the tables one by one and delete items manually. However this can be a very tedious process.

2. Using the command line

If your site is on a dedicated server then it is very likely that you can carry out the optimization tasks using SSH command line.

3. Using plug-ins

Installing an optimization plugin on your website is the final and perhaps the ideal way to keep your WordPress DB running efficiently. There are numerous high-quality plugins available in the official WordPress archive that can automate the clean-up process and give you the opportunity to focus on more essential things such as article writing and search engine optimization.

Which database optimization techniques do you use on your website? Be sure to let us know in the comments section.

Tags: , ,