The primary key

The most important part of designing your data model is how you define the primary key of your tables. As mentioned previously in this chapter, primary keys are built at table-creation time, and have the following options:

PRIMARY KEY ((<partition_key>[,additional <partition_key>])[,<clustering_keys])

Tables in Apache Cassandra may have (both) multiple partition and clustering keys. As previously mentioned, the partition keys determine which nodes are responsible for a row and its replicas. The clustering keys determine the on-disk sort order within a partition.

Get Mastering Apache Cassandra 3.x - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.