theo
theo

Reputation: 165

Cassandra - defining a global TTL and changing an already existing one

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:

The other question would be:

Upvotes: 0

Views: 712

Answers (1)

GAK
GAK

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

Related Questions