Cassandra - Partition Key, Clustering key
Partition Key: It will be hashed and saved across nodes.
Clustering Key: It will group in the same partition key.
PRIMARY KEY((partion key), clustering key)
Example)
create table User(
email text,
name text,
desc text,
user_id uuid
PRIMARY KEY((email), name, user_id)
) WITH CLUSTERING ORDER BY (name DESC, user_id ASC);
Primary Key: email
Clustering Key: name, user_id
Reason of adding a user_id is to ensure the uniqueness of primary key.