MySQL Query performance optimization

Source: Internet
Author: User
Tags mysql query

Why is the query slow?

If you think of a query as a task, it consists of a series of subtasks, each of which consumes a certain amount of time. Optimizing a query is essentially optimizing its subtasks, either eliminating one of the subtasks, or reducing the number of child tasks executed or making the subtasks run faster.

The life cycle of a query is broadly divided into: from the client, to the server, and then on the server to parse, generate execution plan, execute (call the storage engine to retrieve data, call after processing sorting, grouping, etc.) and return the result to the client. To accomplish these tasks, the query needs to spend time in different places, including operations such as network, CPU compute, generate statistics and execution plans, lock waits (mutually exclusive waits), and especially call operations that retrieve data to the underlying storage engine, which also generates a lot of context switches and system calls depending on the storage engine.

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.