How to Complete an MySQL Performance Tune (4 Key Tips)

Apr 20, 2022
Illustration of tiny people working together to turn a giant red dial.

MySQL is among the most used database management systems for websites. If you're running an WordPress site, there's the chance that the site uses MySQL as its database. That makes it essential for you to understand the steps to perform a MySQL tuning of performance.

We'll get started!

Visit Our Video Tutorial for MySQL Performance Tuning

What MySQL is and how it works

MySQL market share numbers.
MySQL market share.

There are various ways to manage databases and MySQL utilizes "relational" as well as "client-server" models. Here's what that means:

  • Relational databases --This kind of database breaks down the data into tables. Thanks to the relational model, it's in a position to join data from multiple tables using "keys" or unique identifiers.
  • Client-server model In this model, your database resides on the server and your website is the client. Users make requests to your website, that in turn query the database.

Learn how to make MySQL perform faster on your own is still useful, but most likely, your hosting provider doesn't manage optimization on your behalf. Let's discuss what optimization means.

4 Tips for Completing a MySQL Performance Tune

If you're using WordPress and would like to know how to improve the speed of your MySQL run faster the best option will not be to focus on particular configurations. Instead, you'll want to modify your database in line with your use of WordPress. Let's discuss what this means.

1. Keep Your Version of MySQL up to date

Most web hosts will automatically update MySQL to the latest version automatically for you. However, if you have full control of your server, you'll have to upgrade your database manually management system. Because you're using WordPress, you probably understand the advantages of keeping your running software that is up-to-date. There are a lot of benefits of MySQL performance tuning, for example:

  • The latest version of MySQL are better optimized and thus faster.

Faster database management software directly results in lower load times. It could be that you don't know the version of MySQL you're using. If you're granted complete access to your server, you can launch from the command line. You can then run the following command:

mysql -v

This parameter -v parameter will provide details about the version of MySQL your server uses. You can compare that information against the most current versions available at the official MySQL website for the most up-to-date versions of MySQL available. If you're uncomfortable using the command-line, you can find out what MySQL version is running on your WordPress dashboard.

To begin, open the dashboard and go into the Tools >> Website Health. Then, go to the Informationtab and click on the Database tab.:

Checking the MySQL version in WordPress through the Tools and Database section.
Checking the MySQL version in WordPress.

Are you interested in knowing the ways we have increased visitors by 1000%?

Join 20,000+ others who receive our weekly newsletter that contains insider WordPress tips!

2. Look through your Database to find orphaned Tables

But, the multitude of unused tables can lead to an overloaded database that could slow the processing down, depending on the server's performance. The ideal scenario is to clean the database when you remove plugins, so you're not able to stop tables and data from accumulating. There are two different ways you can accomplish this job: manually or with a plugin.

Accessing phpMyAdmin via My under the "Database access" section, with an "Open phpMyAdmin" button.
Accessing phpMyAdmin through My.

When you're in phpMyAdmin, you can use the program's searchfeature to search for tables with no use that are related to particular plugins. The issue with this method is that it can be hard to know what queries to use unless the plugin you're trying clean up after has comprehensive information.

A screenshot of a database table, highlight entries relating to Yoast SEO.
Looking for entries related to Yoast SEO in your database.

3. Determine Which Data MySQL Is Autoloading

Every WordPress database contains a wide variety of tables. One table is called "wp_options", and it contains information such as:

  • Theme settings and plugins
  • Your site URL, blog name, description, and many more

If you go to the wp_options table using phpMyAdmin, you'll see a column titled autoload. WordPress looks for rows that have an yes entry for autoload which loads the data each time someone comes to your site and goes to any pages on it:

A screenshot of a database table, showing the wp_options rows.
Checking wp_options for autoloading data.

Out of the box, WordPress should only autoload critical information. Some themes and plugins add information to the wp_options and then set it to load it automatically. As time passes, the autoloading data can slow down responses, as if you have several programs that launch automatically when you turn on your PC.

4. Clean Up Revisions, Drafts Commentary Trashed, Posts and Posts

The Advanced Database Cleaner WordPress plugin logo with the text "Clean & Optimize your Database".
This is the Advanced Database Cleaner WordPress plugin.

You don't need to use the premium version of the plugin to accomplish this job (unlike when dealing with orphaned tables). When you've enabled the plugin, you can go to the WP Cleaner DBtab and look at the General cleanupsection. You'll be able to see a full list of all the transient content that the plugin is able to help you remove from the database.

A screenshot for MySQL performance tuning showing Advanced Database Cleaner plugin with a list of cleanup options for revisions, auto drafts, trashed posts, etc.
Use Advanced Database Cleaner to clean your database.

You can select what tables you want to "clean down" or empty, then perform the procedure manually. Alternatively, the plugin enables the scheduling of cleanups for the tables you prefer, and set it to schedule them for periodic. That last option is your most ideal choice because it will mean you'll only have one task to take care of. However, we recommend that you don't reconfigure the database cleanup to run frequently. So, you'll have access to previous drafts in case you need the information.

Summary

  1. Maintain your copy of MySQL updated.
  2. Make sure you check your database for missing tables.
  3. Discover which of the data MySQL is autoloading.
  4. Cleaning up drafts, revisions posted in trash, posts that have been deleted, as well as comments.

Do you have other tips to fine-tune MySQL databases? Please share them with the MySQL community in the comments below!

Save time, costs and increase site performance:

  • 24/7 help and support 24/7 support from WordPress hosting experts, 24/7.
  • Cloudflare Enterprise integration.
  • Reaching a global audience with 29 data centers across the globe.
  • Optimization through the built-in Application Performance Monitoring.