MySql索引show index 释义的Collation Cardinality Packed Key Block Size Parser的含义和作用

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值