In the previous chapter, we explained how to optimize schema. This is a necessary condition for high performance. But just thinking about schemas is not enough-you also need to design your query. If your query is poor, even if the schema design is perfect, it is useless.
Query optimization, index optimization, and schema optimization should go hand in hand. As you gain experience with optimizing queries in MySQL, you will also understand how to design schemas to support your efficient queries. Similarly, your understanding of schema design affects the type of query you write. This process is time-consuming, so we suggest that you review the first few chapters when you know more.
This chapter starts with a design that considers the query. If a query is inefficient, this is the first thing you should consider. After that, the depth mining query optimizer and the server interior. We'll show you how to find out how MySQL executes the query, and you'll know how to change the query execution plan. Finally, we are looking at MySQL some of the not optimized query some places and explore the query optimizer to make MySQL more efficient execution of the query.
Our goal is to give you a deeper understanding of how MySQL executes the query, so you will think about what is efficient and not efficient, explore MySQL advantages, and avoid drawbacks.