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.pngmysql 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(提示)
网友评论