A compound primary key is composed of more than one column. The order of the columns is important. The structure of a compound primary key is depicted in the following figure:
Columns 1 to A are used as the partition key for Cassandra to determine the node location for the partition. The remaining columns, columns B to N, are referred to as the clustering columns for the ordering of data. The clustering columns are used to locate a unique record in the data node. They are ordered, by default, and have the ability to use the
ORDER BY [DESC] clause in the
SELECT statements. Moreover, we can get the ...