Introducing the Cardinality Estimator
Before we get started, it’s important to have a common frame of reference for a few terms that will be referenced throughout this book:
- Cardinality: Cardinality in a database is defined as the number of records, also called tuples, in each table or view.
- Density: This term represents the average number of duplicate values in each column or column set – in other words, the average distribution of unique values in the data. It’s defined as 1 divided by the number of distinct values.
- Frequency: This term represents the average number of occurrences of a given value in a column or column set. It’s defined as the number of rows times the density.
- Selectivity: This term represents the fraction of the row count that satisfies a given predicate, between zero and one. This is calculated as the predicate cardinality (Pc) divided by the table cardinality (Tc) multiplied by 100: (Pc ÷ Tc) × 100. As...