When creating a table in cassandra, we can provide clustering keys in order, as shown below.
Create table user(partitionkey int, id int, name varchar, age int, address text, insrt_ts timestamp, Primary key(partitionkey, name, insrt_ts, id) with clustering order by (name asc, insrt_ts desc, id asc);
when we insert data into this table, according to the documentation documents cassandra are sorted based on the clustering keys.
When I get records with CQL1 and CQL2, I get the same sort order.
CQL1:
Select * from user where partitionkey=101;
CQL2:
Select * from user where partitionkey=101 order by name, insrt desc, id;
What is the difference between CQL1 and CQL2?
source share