| Published:
| Reading Time:
2 minutes
| Author:

| Keep WordPress Running Smoothly

In this first part of our WordPress Maintenance guide we look at repairing and optimising the WordPress Database.

The best bit about open source software such as WordPress is also its worst point. Anyone, anywhere, with any goal in mind can essentially build a plugin, that can be downloaded and installed into your WordPress site without any real guarantees. No matter how good the intentions of the ‘developer’ are, if their plugin isn’t up to scratch and you install it….. No amount of swearing is going to bring your site back to life. So what can you do to ressurect your crucial website?

Fortunately WordPress actually includes a neat little maintenance mode that can not only repair your database but also optimise it. Read on for step by step instructions.

  • First login to admin section of WordPress blog by visiting .
  • Then go to .You can see screen as show below. It ask you to add a line of code to WordPress’s wp-config.php file.
  • Add below code to your WordPress wp-config.php file and reload/refresh page.
define('WP_ALLOW_REPAIR', true)
  • After refreshing you can see page with options to ‘Repair Database’ and to ‘Repair and Optimize Database’. Just click on one of the option.
  • If you click on ‘Repair Database’ button, WordPress can automatically look for some common database problems and repair them. Internally it executes two sql queries on each WordPress database tables in loop and these queries are CHECK TABLE table_name and REPAIR TABLE table_name .
  • If you click on ‘Repair and Optimize Database’ button, WordPress can also attempt to optimize the database. This improves performance in some situations. Repairing and optimizing the database can take a long time and the database will be locked while optimizing. Internally it executes four sql queries along with above two queries on each WordPress database tables in loop and other two queries are ANALYZE TABLE table_name and OPTIMIZE TABLE table_name .

After this, your system should now be running as expected and maybe even a little faster. Whenever updating your system or performing maintenance, please remember to backup your database before doing so. Trust us, the first time you need a backup you’ll be really glad you bothered.