MySQL Query performance optimization The first chapter why queries are slow

Source: Internet
Author: User
Tags mysql in mysql query

Why query speed is slow

Before trying to write a quick query, we need to be clear that what really matters is response time. 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. If you want to have

Optimize the query, in fact, to optimize the screwdriver task, either eliminate some of the subtasks, or reduce the number of child tasks, MySQL in the execution of the query when the sub-task, which subtasks run very slow? It's not a good place to finish.

The entire list. In general, the life cycle of a query can be seen roughly in order: from the client-to-server and then on the server, generates execution plans, executes, and returns results to the client. Where execution can be considered as the entire health

The most important phase of the life cycle, which includes a large number of calls to retrieve data to the storage engine, as well as post-invocation data processing, including sorting, grouping, and so on.

When these tasks are completed, the query needs to be in different places, including the network, CPU calculations, generating statistics and execution plans, locks, and so on, especially the call operations that retrieve data to the underlying storage engine, which need to be caused by memory operations, CPU operation, and insufficient memory i/ o The operation consumes time.

In every query case that consumes a lot of time, we can see that unnecessary extra actions have been written, that some operations have been repeated many times, and that some operations have been performed too slowly. The purpose of the optimization query is to reduce and eliminate the time spent by these operations.

What we said above is not complete, because first understand the life cycle of the query, the time consumption of clear query is very important for optimizing the query. The second chapter will say how to optimize the query ...

MySQL Query performance optimization The first chapter why queries are slow

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.