1
votes

We can specify compound primary key in cassandra. When we specify only one column as Primary key then how Cassandra will generate clustering key. In cassandra primary key automatically becomes partition key.

Example :- CASE 1 - K1: primary key has only one partition key and no cluster key.

CASE 2 - (K1, K2): column K1 is a partition key and column K2 is a cluster key.

CASE 3 - (K1,K2,K3,...): column K1 is a partition key and columns K2, K3 and so on make cluster key.

In Case 1 how cassandra will choose the Clustering key for a given table with only Specifying Primary Key

Thank you

1

1 Answers

1
votes

In case no clustering key is provided (CASE 1), then cassandra will not choose any clustering key.

How CQL3 maps to cassandra internal data structure

If you describe a table with such a primary key, you will not get WITH CLUSTERING ORDER BY option.