AI engineering glossary · SQL databases
What is cardinality?
Cardinality: In indexing and optimisation, the number of distinct values in a column; in modelling, the count of related rows (one-to-many). The optimiser uses estimated cardinality to judge the size of intermediate results.
Cardinality: an example
A country column with 30 distinct values has low cardinality; user_id in a users table has high cardinality.
Related terms
More SQL databases terms
- CASE expression
- Check constraint
- Clustered index
- COALESCE
- Column
- COMMIT and ROLLBACK
- Common table expression
- Composite index
Where you learn it
Cardinality is part of the AI Engineering Program, which teaches it with notes, a hands-on lab and an exam. The first lesson is free.