Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The Operation Mode of query Optimizer in mysql

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly explains "the operation mode of query optimizer in mysql". The explanation in this article is simple and clear, easy to learn and understand. Please follow the editor's train of thought to study and learn "the operation mode of query optimizer in mysql".

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 best 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 Thank you for reading. That's how the optimizer works in mysql. After the study of this article, I believe you have a deeper understanding of the operation of the query optimizer in mysql, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report