在数学意义上,cardinality (基数或者势)指集合内元素的个数。
在数据库的相关资料中,往往会看到cardinality这个术语。
Base cardinality is
the number of rows in a base table. The base cardinality can be captured by analyzing the table. If table statistics are not available, then the estimator uses the number of extents occupied by the table to estimate the base cardinality.
base cardinality 指一个表中记录的数量。
Effective cardinality is
the number of rows that are selected from a base table. The effective cardinality depends on the predicates specified on different columns of a base table, with each predicate acting as a successive filter on the rows of the base table. The effective cardinality
is computed as the product of the base cardinality and combined selectivity of all predicates specified on a table. When there is no predicate on a table, its effective cardinality equals its base cardinality.
effective cardinality指对表查询操作返回的记录数量
Join cardinality is
the number of rows produced when two row sets are joined together. A join is a Cartesian product of two row sets, with the join predicate applied as a filter to the result. Therefore, the join cardinality is the product of the cardinalities of two row sets,
multiplied by the selectivity of the join predicate.
join cardinality 指在存在join连接的情况下,返回的记录数量
Distinct cardinality is
the number of distinct values in a column of a row set. The distinct cardinality of a row set is based on the data in the column. For example, in a row set of 100 rows, if distinct column values are found in 20 rows, then the distinct cardinality is 20.
distinct cardinality 指数据集中某列不同取值的个数
Group cardinality is
the number of rows produced from a row set after the GROUP BY operator is applied. The effect of the GROUP BY operator is to decrease the number of rows in a row set. The group cardinality depends on the distinct cardinality of each of the grouping columns
and on the number of rows in the row set.
group cardinality 指具有group 子句的查询语句返回的记录的数量。
本文详细解释了数据库中Cardinality的概念及其应用,包括basecardinality(表中记录数量)、effectivecardinality(查询返回记录数量)、joincardinality(连接操作返回记录数量)、distinctcardinality(某列不同值的数量)及groupcardinality(分组后返回记录数量)。这些概念对于理解数据库查询优化至关重要。

1301

被折叠的 条评论
为什么被折叠?



