Skip to content

Report low cardinality indices #31

Closed
@macbre

Description

@macbre

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.

https://dev.mysql.com/doc/refman/5.7/en/show-index.html

Set the threshold of cardinality so that a single value covers at most 20% of table rows:

And finally for case with 20% rows with has_someting=0.

https://www.percona.com/blog/2007/08/28/do-you-always-need-index-on-where-column/

New report - low_cardinality_index

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions