zoukankan      html  css  js  c++  java
  • MYSQL优化——索引覆盖

    索引覆盖:如果查询的列恰好是索引的一部分,那么查询只需要在索引文件上进行,不需要进行到磁盘中找数据,若果查询得列不是索引的一部分则要到磁盘中找数据。

    建表:

    create table test_index(
    id int primary key auto_increment,
    name  char(10) not null default ``,
    email  char(10) not null default ``,
    index  c (`id`,`name`)
    ) engine = Innodb charset utf8;
    
    insert into test_index (`name`,`email`) values ('datou','111@qq.com'); ,('datou','111@qq.com');

    执行如下一条语句:

    explain select id ,name from test_index ;

    image

    执行另一条语句看如何:

    explain select id ,name ,email from test_index ;

    image

  • 相关阅读:
    K-means聚类
    支持向量机_原理
    回归+内插
    ftp 服务器
    cmd 切换python版本
    cookie
    类加载器
    GC
    jvm结构
    mysql文件
  • 原文地址:https://www.cnblogs.com/webph/p/6549285.html
Copyright © 2011-2022 走看看