A source of confusion may be the use of the word in two different contexts - data modelling and database query optimization.
In data modelling terms, cardinality is how one table relates to another.
1-1 (one row in table A relates to one row in tableB)
1-Many (one row in table A relates to many rows in tableB)
Many-Many (Many rows in table A relate to many rows in tableB)
There are also optional participation conditions to the above (where a row in one table doesn't have to relate to the other table at all).
When talking about database query optimization, cardinality refers to the data in a column of a table, specifically how many unique values are in it. This statistic helps with planning queries and optimizing the execution plans.
Top comments (0)