Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

What is the operation of the query optimizer in mysql

Shulou Source: shulou.com Published: 2022-05-31 10:54:26 09月23日 Update

In this article, the editor introduces in detail "what is the operation of the query optimizer in mysql". The content is detailed, the steps are clear, and the details are handled properly. I hope that this article "what is the operation of the query optimizer in mysql" can help you solve your doubts.

1. MySQL uses a cost-based optimizer, which attempts to predict the cost of a query using a certain execution plan and selects the optimizer with the lowest cost.

2. The query optimizer needs to obtain the corresponding statistics from the storage engine to generate the execution plan of the query.

The storage engine provides the optimizer with corresponding statistical information, including: how many pages are there in a table or index, what is the cardinality of each index in each table, the length of data rows and indexes, the distribution of indexes, and so on. The optimizer selects the implementation plan based on this information.

Example

Mysql > EXPLAIN SELECT * FROM tbl_name WHERE 0gamma Gmail * 1. Row * * id: 1select_type: SIMPLEtable: NULLtype: NULLpossible_keys: NULLkey: NULLkey_len: NULLref: NULLrows: NULLExtra: Impossible WHERE read here, this article "what is the operation of query optimizer in mysql" has been introduced. If you want to master the knowledge of this article, you still need to practice and use it. If you want to know more about the articles, you are welcome to follow the industry information channel.

Tags: Queries indexes information costs articles content engines data storage statistics proper lowest middle cardinality examples ideas new knowledge more steps knowledge Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Microsoft Shulou Information Huawei Docker vpn