Simple MySQL optimization tool-slow query and mysql optimization tool

Source: Internet
Author: User
Tags mysql optimization tool

Simple MySQL optimization tool-slow query and mysql optimization tool

Slow Query

First, enabling slow queries is a prerequisite regardless of the optimization. The slow query Mechanism records slow query statements (events) to provide optimization objectives for DB maintenance personnel.

Check whether slow query is enabled

Passshow variables like 'slow_query_log'This statement can be used to find the slow query status (On/Off ).

Enable slow Query

MySQL version used in this article: MariaDB-10.1.19. Note that there are differences between MySQL versions.

Add the following under [mysqld:

[Mysqld] port = 3306slow-query-log = 1 # slow query: confirm to enable slow-query-log-file = "D:/xampp/mysql/log/mysql-slow.log" # slow query: log File and path long_query_time = 5 # Slow query: Specify the statements that have not been completed for more than 5s, and execute slow statements.

Optimization steps

Observe the log and lock the target statement to be optimized. Pay attention to SQL settings, such:SQL_NO_CACHE.

Focus on complex statement writing. Complex statements have a high degree of freedom. In addition, the special nature of SQL syntax leads to complicated statements with the same function in different writing methods, which may have a different efficiency.

Although we have principles in various occasions, we can make efficient localization Optimization for specific application scenarios.

Statements that cannot be optimized. When we use the above two methods and more optimization methods that are not mentioned in this article, we may still face optimization failures. If the business layer is not corrected, the data layer is indeed powerless.

Conclusion

When the game cannot be optimized, I can't help but think of my favorite game design industry.

If you know something about it, you will find that there are actually a lot of excellent designs in game design, but most of them are embarrassed by the local technical skills at that time, however, it is impossible to achieve a colorful game design.

I also remember my friend who made the UI spoke to me last year: I was afraid that I would design it very cool or humanistic, but the front-end could not implement that design.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.