cassandra Cassandra keys Partition key, clustering key, primary key


Cassandra uses two kinds of keys:

  • the Partition Keys is responsible for data distribution across nodes
  • the Clustering Key is responsible for data sorting within a partition

A primary key is a combination of those to types. The vocabulary depends on the combination:

  • simple primary key: only the partition key, composed of one column
  • composite partition key: only the partition key, composed of multiple columns
  • compound primary key: one partition key with one or more clustering keys.
  • composite and compound primary key: a partition key composed of multiple columns and multiple clustering keys.