Collation
有值’A’(升序)或NULL(无分类)
Cardinality
官方文档的解释:
An estimate of the number of unique values in the index. This is updated by running ANALYZE TABLE or myisamchk -a.
Cardinality is counted based on statistics stored as integers, so the value is not necessarily exact even for small tables.
The higher the cardinality, the greater the chance that MySQL uses the index when doing joins.
总结cardinality列的值有以下特性:
1. 列值代表的是此列中存储的唯一值的个数(如果此列为primary key 则值为记录的行数)
2. 列值只是个估计值,并不准确。(我用的innodb数据库实际的例子中这个值也不是太准确)
3. 列值不会自动更新,需要通过analyze table来进行更新。
4. 列值的大小影响join时是否选用这个index的判断。
5. 初建index时,MyISAM的表cardinality的值为null,InnoDB的表cardinality的值大概为行数。
6. MyISAM与InnoDB对于cardinality的计算方式不同。
本质:Cardinality表示是某列作为索引,不重复记录数的预估值。
Cardinality相当于对索引列进行select count(distinct field