索引(index)是帮助mysql搞笑的获取数据的数据结构,这些数据结构以某种方式引用数据,这样就可以在这些数据结构上实现高级查找算法,这种数据结构就是索引。
索引的优劣势:
Mysqo的索引是在存储引擎层实现的,不同的存储引擎又不同的结构。
索引结构:
在面试中问道索引的结构一般都是B+tree索引
创建索引:
create index 索引名称 on 那一张表(里面的字段);
create index ids_table_hei on text(name);
创建唯一索引:
create unique index 索引名称 on 那一张表(里面的字段);
create unique index ids_table_hei on text(id);
创建联合索引:
create index 索引名称 on 那一张表(里面的字段1,字段2,字段3);
create index ids_table_hei_ha_ka on text(name,age,sex);
查看索引:
show index from 表名
删除索引:
drop index 索引名 on 表名