Reputation: 165
I know that one can define a TTL when making an INSERT / UPDATE to a Cassandra column / table etc. (INSERT INTO ... USING TTL 1234
).
One can also define a default TTL when creating a table (CREATE TABLE ... WITH default_time_to_live="1234";
).
However is it possible to define defaults that are more global? Possible scenarios would include:
cassandra.yaml
config?) a global TTL for any new keyspacesThe other question would be:
ALTER TABLE
will not work. Is it right? Can anyone suggest some better ideas? Upvotes: 0
Views: 712
Reputation: 1078
Your kind of answered your own question. 1. TTL is only possible at column or at Table level. 2. To alter the TTL of an existing column you need to reinsert it with the new value.
You can set the TTL at table level with the create table ddl and with the table property default_time_to_live.
When you rewrite the column it will Upsert it with the new TTL. there wont be two rows lying. Remember every DML goes into cassandra with a timestamp and the latest update wins.
Upvotes: 0