Was this page helpful?
The primary key can be made up of two parts: the partition key and optional
clustering columns. The
user_id column is the partition key in this example.
It determines how data gets distributed across the cluster.
Additional columns, if present, can be specified as clustering columns, which determine the internal sorting of data within a partition.
CREATE TABLE my_keyspace.orders (
PRIMARY KEY (order_id, product_id)
In this example,
order_id is the partition key, and
the clustering key.
Partitions are determined by the partition key, a part of the primary key.
Data is distributed across nodes based on the partition key. In the
order_id determines the partition.