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. WHERE
子句中的条件,MySQL优化器会考虑许多技术来高效地执行SQL查询中涉及的查找。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.EXPLAIN
计划中表明查询优化良好的方面,并学习SQL语法和索引技术,以便在看到一些低效操作时改进计划。