mysql indexes

create index

https://www.w3resource.com/mysql/creating-table-advance/create-index.php

1⃣️ when create table
2⃣️ create index statement

index type: index数据结构

http://www.mysqltutorial.org/mysql-index/mysql-create-index/

image.png
mysql supported indexes

http://www.mysqltutorial.org/mysql-index/

1⃣️主要的两个索引:
unique index
clustered index: 一般用 primary key 作用 clustered index:如果没有primary key, 则采用第一个unique not null 字段作为clustered index; 既没有primary key, 也没有 unique not null,则InnoDB internally generates a hidden clustered index named GEN_CLUST_INDEX on a synthetic column containing row ID values.
https://dev.mysql.com/doc/refman/5.6/en/innodb-index-types.html

2⃣️ 索引附加条件:
prefix index
invisible index
descending index:the leftmost(靠左原则)
composite index

3⃣️ 优化器参数:
index cardinality(基数)
index hint(提示)

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容