8.4 中文镜像

MySQL 8.4 参考手册 · 中文镜像

正文为中文,英文原文默认隐藏。点击任意中文段落即可展开 / 收起对应英文原文。

打开官方英文原文 ↗

译文由机器翻译生成,仅供理解参考;有疑问请以官方英文原文为准。

MySQL 8.4 参考手册 / 10 优化 / 10.8 理解查询执行计划
中文点击中文段落可显示 / 隐藏英文原文本页译文覆盖 100%

10.8 理解查询执行计划10.8 Understanding the Query Execution Plan

根据您的表、列、索引的详细信息以及 WHERE 子句中的条件,MySQL 优化器会考虑多种技术,以高效地执行 SQL 查询中的查找。对一个大型表的查询可以在不读取所有行的情况下进行;涉及多个表的连接可以在不比较所有行组合的情况下进行。优化器选择执行以实现最有效查询的一组操作称为 “查询执行计划”,也称为 EXPLAIN 计划。您的目标是识别 EXPLAIN 计划中表明查询优化良好的方面,并学习 SQL 语法和索引技术,以在发现某些低效操作时改进计划。Depending on the details of your tables, columns, indexes, and the conditions in your WHERE clause, the MySQL optimizer considers many techniques to efficiently perform the lookups involved in an SQL query. A query on a huge table can be performed without reading all the rows; a join involving several tables can be performed without comparing every combination of rows. The set of operations that the optimizer chooses to perform the most efficient query is called the “query execution plan”, also known as the EXPLAIN plan. Your goals are to recognize the aspects of the EXPLAIN plan that indicate a query is optimized well, and to learn the SQL syntax and indexing techniques to improve the plan if you see some inefficient operations.