Mysql SQL优化系列之——执行计划连接方式浅释

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

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

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

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

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

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

  7. using_index:a covering index is used(通过覆盖索引访问一个索引);

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

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

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

猜你喜欢

转载自www.cnblogs.com/lhdz_bj/p/9930838.html