cluster index就是table本身
table中所有的rows按照排序存在磁盘上
clustered index 用指定的字段对所有行落盘排序
When you define a primary key for an InnoDB table, MySQL uses the primary key as the clustered index.
If you do not have a primary key for a table, MySQL will search for the first
UNIQUE
index where all the key columns are[NOT NULL](http://www.mysqltutorial.org/mysql-not-null-constraint/)
and use thisUNIQUE
index as the clustered index.
In case the InnoDB table has no primary key or suitable UNIQUE index, MySQL internally generates a hidden clustered index named GEN_CLUST_INDEX on a synthetic column which contains the row ID values.
As the result, each InnoDB table always has one and only one clustered index.
- 总结下,
用primary key 作为clustered index
用 UNIQUE 作为 clustered index
用行id作为cluster index