索引的一些特性
先看一下一些常见的索引吧!
-
主键索引(primary key)
-
唯一键索引(unique)
-
普通索引(index)
-
全文索引(fulltext)
在看一下索引的基本原理~ -
首先索引相当于创建二叉树
-
然后基于二叉树这种查找的性质当我们需要查找8000000的数据最多也就找一个23次就可以了
-
但是了当我们对原有数据进行增删改查,那么在空间换时间的基础思想上理解,需要的维护速度肯定也是会增长很多的
创建索引 -
主键创建
-
唯一键创建索引
-
普通索引的创建
-
全文索引的创建
删除索引
第一种方法-删除主键索引: alter table 表名 drop primary key;
第二种方法-其他索引的删除: alter table 表名 drop index 索引名; 索引名就是show keys from 表名 中的 Key_name 字段 mysql> alter table user10 drop index idx_name;
第三种方法方法: drop index 索引名 on 表名 mysql> drop index name on user8;