If you have a WordPress website, it is bound to have a database irrespective of the website being functional or redundant. A WordPress database stores all the data of your website. It includes posts, pages, comments (if any), website, theme and plugin settings, as well as, entries from forms and links if any.
Anything that’s filled with unwanted data hampers its performance. Optimization is, therefore, the key to efficiency and increasing performance. Optimizing your WordPress database ensures that your database size is reduced and the load speed of your website is considerably improved.
In this article, I’ll walk you through how you can optimize WordPress database.
How to Optimize WordPress Database
There are two ways to optimizing your WP database we’ll be covering both:
Method I: Using phpMyAdmin
phpMyAdmin is the most preferred tool to manage your WordPress database. You can find phpMyAdmin in your cPanel under the Databases section.
- Once you login to phpMyAdmin you can have a look at the size of each table in your database. The size of a table is dependent on the amount of data stored in it. More the data stored, more are the rows in a table which in turn means increased size.
- Apart from size, there is another column known as Overhead. Overhead is a temporary disk storage space that stores queries. Even though the overhead of a table might increase it hardly affects the performance of the website.
- The figure below shows the landing page of phpMyAdmin and the extreme right-hand side columns show the ‘Size’ and ‘Overhead’ column.
- To optimize your database select all the tables in your database by clicking on the checkbox. Next, click on the drop-down menu and select ‘Optimize Table’ and click on ‘Go’
Alternatively, you can also use a SQL command to optimize the tables. The command to be used is:
Query: OPTIMIZE TABLE ‘tablename’
Example: OPTIMIZE TABLE ‘wp_links’
- After this, the command is executed and you get a message saying your WordPress database has now been optimized.
You can even refer to the official WordPress guide for Automatic Database Optimizing.
Method II: Using a Plugin
If you’re sceptical about using phpMyAdmin to optimize WordPress database then using a plugin for the same is a safe option.
- Before optimizing your WordPress database it is preferable if you can take a backup. Some of the options for taking backup are Codeguard or UpdraftPlus.
- Once you’re done taking a backup install a plugin to optimize your WordPress database. WP Optimize is one of the popular plugins with over 7,00,000+ active installations. Check out this post on how to install a WordPress plugin.
- After your plugin is installed and activated, click on the WP-Optimize tab in your WordPress dashboard and the settings page will open.
- In the above figure, click on the checkboxes you want to optimize. Before clicking on the red text icons make sure to take a backup as these store sensitive data.
- After clicking on the items you want to optimize click on ‘Run all selected optimizations’ button. The plugin now starts optimizing your WordPress database. On completion of the operation, you will be notified.
I hope this article helped you understand how to optimize WordPress database. Did you face any issues will optimizing your WordPress database or have a tip to share? Please let us know in the comments section below.