您的位置:宽带测速网 > mysql教程 > Mysql SQL优化中执行计划连接方式是怎样的

Mysql SQL优化中执行计划连接方式是怎样的

2025-06-24 08:11来源:互联网 [ ]

关系库SQL调优中,虽然思路都是一样的,具体方法和步骤也是大同小异,但细节却不容忽视,尤其是执行计划的具体细节的解读中,各关系库确实有区别,特别是mysql数据库,与其他关系库的差别更大些,下面,我们仅就SQL执行计划中最常见的连接方式,做以下简要介绍和说明。

    system: a system table which is a constant table(访问一个常量系统表);

    const: a constant table(访问一个常量表);

    eq_ref: a unique or primary index with an equality relation(通过等值操作去访问一个唯一或主键索引);

    ref: an index with an equality relation, where the index value cannot beNULL(通过一个等值操作去访问一个不包含null值的索引);

    ref_or_null: an index with an equality relation, where it is possible for the index value to beNULL(通过等值操作去访问一个可能包含null值得索引);

    range: an index with a relation such asBETWEEN,IN,>=,LIKE, and so on(通过类似between,in,>=,like等操作去访问一个索引);

    using_index:a covering indexis used(通过覆盖索引访问一个索引);

    index: a sequential scan on an index(通过顺序扫描方式访问一个索引);

    ALL: a sequential scan of the entire table(通过顺序扫描方式访问整张表)。

此外,mysql中,无论对表或索引的访问操作还是多表间的连接操作,一般都统称为连接,这里,大家需要注意。