8

Before I`ve found good explanation of keys in Cassandra:

Difference between partition key, composite key and clustering key in Cassandra?.

Now I am reading about partitioner and there I can see term "row key". What is the row key? How can I list it with CQL?

ipeacocks
  • 2,187
  • 3
  • 32
  • 47

1 Answers1

13

The row key is just another name for the PRIMARY KEY. It is the combination of all the partition and clustering fields, and it will map to just one row of data in a table. So when you do a read or write to a particular row key, it will access just one row.

In terms of the partitioner, that only uses the partition key fields, and it generates a token hash value that determines which node in a cluster the partition will be stored on. Individual rows are stored within partitions, so if there are no clustering columns, then the partition will hold a single row and the row key would be the same as the partition key.

If you have clustering columns, then you can store multiple rows within a partition and the row key will be the partition key plus the clustering key.

Jim Meyer
  • 9,275
  • 1
  • 24
  • 49
  • 3
    ROW KEY is now called PARTITION KEY, If a table has one column defined as PRIMARY KEY then the same column will be considered as PARTITION KEY. In case of the compound key (i.e. PRIMARY KEY(col1, col2) ) the first column (col1) will be considered as PARTITION KEY. – VirtualLogic Feb 15 '18 at 04:19