Correct MySQL tuning Solution

Source: Internet
Author: User

The following articles mainly introduce the actual operation steps for MySQL optimization. We first start from improving the actual running speed of the MySQL (best partner with PHP) server, there are three ways to improve the running speed of MySQL (the best combination of PHP and MySQL) servers. The efficiency is as follows:

1. Replace faulty hardware.

2. Configure MySQL (the best combination of PHP and MySQL.

3. Optimize the query.

Replacing faulty hardware is usually our first consideration, mainly because the database occupies a large amount of resources.

However, this solution is limited to this. In fact, you can usually increase the CPU speed of the central processor or the disk speed by 4 to 8 times.

The second method is to optimize MySQL on a MySQL (the best combination with PHP) server, also known as MySQL (the best combination with PHP) d. Tuning this process means allocating memory appropriately and letting MySQL (the best combination with PHP) d know what type of load it will bear. Speed up disk operation is not as fast as reducing the number of disk accesses required.

Similarly, ensure that MySQL (the best combination with PHP) A proper process operation means that it spends more time on service queries than processing background tasks such as processing temporary disk tables or opening or closing files. Tuning MySQL (the best combination with PHP) d is the focus of this article.

The best way is to make sure that the query has been optimized. This means that an appropriate index is applied to the table, and the query is written by fully utilizing the MySQL (best combination with PHP) function. Although this article does not include the content of the query optimization, many of the works have already discussed this topic), but it will configure MySQL (the best combination with PHP) d To report the query that may require MySQL optimization.

Although the order has been assigned for these tasks, you should still pay attention to the hardware and MySQL (the best combination with PHP) d settings to facilitate proper MySQL tuning query. The machine speed is slow. I have seen a very fast machine fail due to heavy load when running well-designed queries, because MySQL (the best combination with PHP) d. It is occupied by a lot of busy work and cannot be queried by the Service.

Slow query of records

On an SQL Server, data tables are stored on disks. Indexes provide a method for the server to search for specific data rows in a table instead of the entire table. To search for the entire table, it is called a table scan. Generally, you may only want to obtain a subset of the data in the table. Therefore, full table scan will waste a lot of disk I/O, and thus a lot of time. When data must be connected, this problem is more complicated, because multi-row data at both ends of the connection must be compared.

Of course, table scanning does not always cause problems. Sometimes reading the entire table is more effective than selecting a part of the data from it. The query planner in the server process is used to make these decisions ). If the indexing efficiency is very low or indexes cannot be used at all, the query speed will be slowed down and the problem will become more significant as the server load and table size increase. Queries whose execution time exceeds the specified time range are called slow queries.

You can configure MySQL (the best combination with PHP) d to record these slow queries to the slow query log with the appropriate name. The Administrator then checks the log to help them determine which parts of the application need further investigation. Listing 1 shows the configuration that needs to be done in my. cnf to enable slow query logs.

Related Article

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.