MySQL 中的基数是什么?

2021-11-20 00:00:00 indexing mysql

MySQL 中的基数是什么?请用简单的非技术语言解释.

What is cardinality in MySQL? Please explain in simple, non-technical language.

如果任何表的索引详细信息显示一个字段的基数,例如 group_id 为 11,那么这意味着什么?

If a index detail of any table displays the cardinality of a field say group_id as 11, then what does that mean?

推荐答案

Max cardinality: All values are unique

Max cardinality: All values are unique

最小基数:所有值都相同

Min cardinality: All values are the same

有些列被称为高基数列,因为它们有限制(如唯一),禁止您在每一行中放置相同的值.

Some columns are called high-cardinality columns because they have constraints in place (like unique) prohibiting you from putting the same value in every row.

基数是影响聚类、排序和搜索数据能力的属性.因此,对于数据库中的查询计划者来说,这是一个重要的衡量标准,是他们可以用来选择最佳计划的启发式方法.

Cardinality is a property which affects the ability to cluster, sort and search data. It is therefore an important measurement for the query planners in DBs, it is a heuristic which they can use to choose the best plans.

相关文章