0 votes
in Cassandra by
Differentiate between the various types of Primary Keys in Cassandra.

1 Answer

0 votes
by

In the Single Primary Key, there is only a single column as a Primary Key.

The column is also called partitioning key. Data is partitioned on the basis of that column. Data is spread on different nodes on the basis of the partition key.

Databases Training

In Compound Primary Key, data is partitioned and then clustered

race_name is the partitioning key and race_position is the Clustering key. Data will be partitioned on the basis of race_name and data will be clustered on the basis of race_position. Clustering is the process that sorts data in the partition. Retrieval of rows is very efficient when rows for a partition key are stored in order, based on the clustering column.

Composite partitioning key is used to create multiple partitions for the data

race_year and race_name are the composite partition key and data will be partitioned on the basis of both columns. Data will be clustered on the basis of the rank. It is used when too much data is present on the single partition.

...