Reputation: 2822
I know I can change the on-disk sorting to descending by defining a table like this:
create table timeseries (
event_type text,
insertion_time timestamp,
event blob,
PRIMARY KEY (event_type, insertion_time)
)
WITH CLUSTERING ORDER BY (insertion_time DESC);
But the problem is that now insertion_time
is part of a composite unique constraint (event_type
+ insertation_time
) which is not desired.
Is there any way to change the order without making the column a primary key? Something like this:
create table timeseries (
event_type text,
insertion_time timestamp,
event blob,
PRIMARY KEY (event_type)
)
WITH CLUSTERING ORDER BY (insertion_time DESC);
Upvotes: 1
Views: 90
Reputation: 16303
What you want is not possible because in the second table schema, there will only every be one row for every single partition. Another way of putting it is -- there are no rows to sort since there is only ever one row.
You can only specify the CLUSTERING ORDER
if there is a clustering column to sort. Cheers!
Upvotes: 1