sql - low mysql index cardinality yet data is diverse -


so have table index on column card

when run

select count(distinct(card)) table 

it returns 490 distinct entries

however when run

show indexes s_edge_type_group_join; 

it revealls cardinality of index card on column card 1. index has column in it

why case? why isn't cardinality of index reflect diversity of data?

cardinality returned show index estimate, used optimizer build query execution plan:

http://dev.mysql.com/doc/refman/5.0/en/show-index.html

cardinality

an estimate of number of unique values in index. updated running analyze table or myisamchk -a. cardinality counted based on statistics stored integers, value not exact small tables. higher cardinality, greater chance mysql uses index when doing joins.

depending way populated table, values might outdated. and, paraphrase doc, in case should use analyze table update statistics.


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -