3
votes

Consider the following Insert statement.

    INSERT INTO NerdMovies (movie, director, main_actor, year)
                    VALUES ('Serenity', 'Joss Whedon', 'Nathan Fillion', 2005)
    USING TTL 86400;

Does the TTL field specify the time to live for the whole set of columns for a particular primary key or just one particular column. Because i would want to specify a TTL for a whole set of columns that should get deleted after the TTL expires.

2

2 Answers

3
votes

Ok, I figured it out my self. It sets the TTL for the whole set of columns. so, all the columns for a particular primary key will be deleted once the TTL expires.

3
votes

@sayed-jalil To be more precise, it will set TTL for the columns that you mentioned in the INSERT/UPDATE statement. So for instance, if at time t you do


    INSERT INTO NerdMovies (movie, director, main_actor, year)
    VALUES ('Serenity', 'Joss Whedon', 'Nathan Fillion', 2005)
    USING TTL 86400;

if you then do the following at time t + 10


    UPDATE USING TTL 86400 NerdMovies SET year = 2004;

then columns movie, director, main_actor will have TTL of t+86400 and column year will have TTL of t+10+86400

Hope that makes sense.