https://dev.mysql.com/doc/refman/5.6/en/innodb-indexes.html
clustered index
EveryInnoDB
table has a special index called the clustered index.primary key
Typically, the clustered index is synonymous with the [primary key].
clustered index: 等同于primary key
- InnoDB table 一定会有 clustered index
1⃣️ table 定义了 primary key column
2⃣️ table 没有定义 primary key column, 但是定义了 unique not null 字段, 选取第一个合适的 unique not null 字段作为 clustered index
3⃣️ table 没有定义 primary key 字段和并且没有定义合适的 unique not null 字段, 则自动定义一个隐藏字段, 作为 clustered index
- secondary indexes:
非 clustered index 都是 secondary index
- InnoDB仅支持 b-trees index数据结构。
- 支持全文索引:
CREATE TABLE opening_lines (
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
opening_line TEXT(500),
author VARCHAR(200),
title VARCHAR(200),
FULLTEXT idx (opening_line)
) ENGINE=InnoDB;