Considering the table below, does the order of the partition key a
and b
matter?
CREATE TABLE t (
a varchar,
b int,
c text,
PRIMARY KEY ((a,b))
);
If a
have more unique elements, should it be in the first or last position?
The partition key as a whole uniquely identifies a partition in the cluster and gets hashed into a single token value regardless of how many columns there are in the composite partition key.
How the columns are ordered does not matter since all columns are required to identify a single partition. Cheers!