Index On Mysql Column Has Lower Cardinality Than Count Distinct?
I have a varchar(50) field named token. When I do count(distinct token) from table I get ~ 400k. However, if I do create index idx on table (token) The cardinality is only 200
Solution 1:
The cardinality is an estimate of the number of unique values in the index. According to the documentation:
Cardinality is counted based on statistics stored as integers, so the value is not necessarily exact even for small tables.
Post a Comment for "Index On Mysql Column Has Lower Cardinality Than Count Distinct?"