ashok.dcosta_187920 avatar image
ashok.dcosta_187920 asked Erick Ramirez commented

What does cardinality mean in Cassandra?

What is cardinality in cassandra ? How do you define cardinality in cassandra ?

10 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

1 Answer

Erick Ramirez avatar image
Erick Ramirez answered Erick Ramirez commented

In mathematics, cardinality is the number of elements in a set or a group.

In databases, cardinality is an attribute of the uniqueness of data in a column or field.

A column which has high cardinality means that the range of values are mostly unique. An example is a column containing email addresses. It has a high cardinality since only 1 person can have each email address.

A column which has low cardinality means that it contains values that appear repeatedly. An example is a boolean column. It has a low cardinality since there are only 2 possible values -- true or false.

I assume you're asking because you probably came across it while learning about secondary indexes in Cassandra. If so, you might be interested in the document on when to use a secondary index. Cheers!

2 comments Share
10 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

ashok.dcosta_187920 avatar image ashok.dcosta_187920 commented ·

Hi Erick ,

Is the cardinality is the relationship between two tables for example Videos and actors , 1 video can have many actors and 1 actor can belong to many videos , so the cardinality is Many to Many relationship is this correct ? Or is it different in cassandra as you said above cardinality is an attrribute of uniqueness on column . I was watching the below video .

Please advise how to we define cardinality in cassandra ?

0 Likes 0 ·
Erick Ramirez avatar image Erick Ramirez ♦♦ ashok.dcosta_187920 commented ·

The definition in my answer relates to Cassandra. Cheers!

On a side note, I converted your post to a comment since it's not an "answer". Please don't post comments as answers since it's confusing for new members of the community. :)

0 Likes 0 ·