Cardinality

简介:

The terms "high cardinality" and "low cardinality" are frequently used when discussing table columns. A high cardinality column means that a column has many unique values. For example, a primary key column is a high cardinality column since each value is, by definition, unique. A low cardinality column is the opposite. For example, a column representing sex only has two possible values (Male and Female).   High cardinality columns are often great candidates to be the first (and sometimes only) column in an index. This is due to the fact that the index will only request a small number of rows from the table.   Low cardinality columns are more difficult to index correctly. For example, consider the following query: select * from employee where sex='F'; Without an index, this query will perform a full table scan. >This seem undesirable. However, adding an index will reduce the number of rows retrieved by the table, but may actually take much longer due to the index usage. In this case, a normal b-tree index is probably a bad idea. New features offered by database vendors (such as Oracle's bitmap and key compressed indexes) might be better solutions for low cardinality columns.



本文转自maclean_007 51CTO博客,原文链接:http://blog.51cto.com/maclean/1277866

相关文章
|
关系型数据库 MySQL 索引
Mysql索引之-cardinality
cardinality 是估算索引中不重复的值。
397 0
|
SQL 关系型数据库 BI
PG:什么是grouping sets
PG:什么是grouping sets
126 0
|
存储 SQL 关系型数据库
Optimizing Queries with EXPLAIN(用explain来优化查询语句)
Optimizing Queries with EXPLAIN(用explain来优化查询语句)
41 0
1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column 'information_schema.PROFILING.SEQ' which is not functionally dependent on columns in GROUP BY clause
1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column 'information_schema.PROFILING.SEQ' which is not functionally dependent on columns in GROUP BY clause
202 0
1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column 'information_schema.PROFILING.SEQ' which is not functionally dependent on columns in GROUP BY clause
|
存储 关系型数据库 MySQL
使用filesort来满足ORDER BY (Use of filesort to Satisfy ORDER BY )
filesort ORDER BY (Use of filesort to Satisfy ORDER BY ) MySQL
168 0
|
索引 存储 关系型数据库