MySQL Performance Tuning Tips (that work in 2023) – Devart

Check the

recommended hardware and software requirements for MySQL

The first thing to do, especially if you own a low-end PC, is to check the optimal hardware and software requirements for MySQL, as hardware limitations can have a significant impact on performance

. Minimum MySQL

database server hardware requirements (for versions 5.7 – 8.0):

  • 1 GHz processor
  • 512 MB RAM

Hard disk space depending on database size

It is also worth mentioning that it is best to use the most current official version of MySQL if possible


Optimizing memory

, disk, and CPU usage At the hardware level, you

can perform a lot of actions to improve hardware and software resources


Disk space If you’re using a traditional hard disk drive (HDD) and looking for a performance improvement, you should consider upgrading to SSD. The official MySQL documentation does not explicitly state the disk space or memory configuration required to run the MySQL server efficiently, as they mainly depend on the size of the database or potential databases. However, it would be a good idea to monitor disk performance, using the sar and iostat system performance tools, for example. If disk usage is significantly higher than other resource usage, you should definitely add more storage or upgrade to a faster one.

RAM Lack of memory can also seriously affect database performance. It may seem trite, but if your server is running out of memory and RAM disk performance isn’t satisfactory, it’s worth adding more memory. When you run out of RAM, the MySQL server caches physical memory, which slows down performance. Therefore, MySQL memory optimization is extremely important.

CPU Optimizing MySQL

CPU usage should start with a careful analysis of the MySQL processes taking place on your machine and the percentage of processor usage they require. The CPU is not cheap to upgrade, however, if it is a bottleneck, an upgrade will be necessary.

The network is a crucial part of the MySQL infrastructure and it is important to track and analyze network traffic to ensure that you have sufficient resources to manage your workloads. Make sure you have a good and stable internet connection for your MySQL server to work properly.

Tools for tuning

software performance


the MySQL Index for Performance

Proper indexing to improve performance is not easy and requires a certain level of expertise, however, it is one of the best performance improvements you can make to your database


MySQL uses indexes such as a workbook index or roadmap to quickly find values for a given query. Without indexes, MySQL will scan the entire table row by row to find the relevant data. Therefore, index optimization aims to speed up data recovery. Indexes are not visible to users and contain information about where the actual data is stored. It’s also worth noting that the length of the MySQL index for InnoDB tables has limits depending on the row format.

MySQL indexes are extremely useful for large data sets and index tuning is the right thing to do if your database is growing rapidly. Indexes are particularly beneficial for the following operations: finding the rows that match a WHERE clause, retrieving data with JOINs, sorting and grouping data with the help of ORDER BY and GROUP BY.

So why not insert as many indexes as you can? That would be a bad idea: unnecessary indexes take up space and waste system time, not to mention they also add costs to queries since indexes need to be updated. Therefore, you need to find the right balance to achieve optimal use of the MySQL index.

Improve performance with


One of the first tuning tips for those who have a heavy load on their database would be to try switching to InnoDB from the MyISAM storage engine. By having a clustered index, with data on consecutive physical pages and blocks, InnoDB performs better for large volumes of data compared to MyISAM.

InnoDB also features an extensive set of variables and advanced settings that can be configured to further improve MySQL performance. The performance settings of InnoDB are more extensive, and therefore there are more ways to tune InnoDB for higher performance instead of tuning MyISAM.

MySQL Query Optimization

Now let’s take a look at how to optimize MySQL query for better performance and speed. For those who want to improve MySQL queries, it would be a good idea to follow the following optimization techniques.

Add indexes to columns used in WHERE, ORDER BY, and GROUP BY clauses This will increase MySQL query performance as the MySQL server will get results from a database significantly faster

. Specify the required columns in the SELECT

statements Try to avoid using SELECT*FROM, as it retrieves all the columns in the table and thus causes additional load on the server and slows down its performance. Set as a rule to always specify the columns of the SELECT statements.


sparingly Another good tip for query tuning is to use DISTINCT and UNION operators only when necessary, as queries with them lead to server overload and generally increase response time. Consider replacing UNION with UNION ALL and DISTINCT with GROUP BY to bring more efficiency to the process.

Avoid using wildcards at the beginning of LIKE patterns MySQL queries with LIKE operators often lead to decreased server performance, so they should be used with care. MySQL cannot use indexes when the LIKE pattern starts with a wildcard, for example, ‘%xyz’, and performs a full analysis of the table in this case. You should keep this in mind when optimizing MySQL queries and try to use ‘xyz%’ instead whenever possible.


instead of OUTER JOINs Use OUTER JOIN only when necessary. MySQL does a lot more work getting the results for OUTER JOINs compared to INNER JOINs. We recommend that you check the performance of your JOIN queries and, in case it is not satisfactory, start converting your OUTER JOINs to INNER JOINs when possible. Optimizing MySQL JOINs can lead to dramatic performance improvement.

Adjust server options to increase

performance MySQL Profiling and

Query Optimization with dbForge Studio for


MySQL Performance Optimization Rules