cqlsh:ks> // Create table with Primary Key cqlsh:ks> drop table student; cqlsh:ks> create table student( ... name text, ... class text, ... primary key(name)); cqlsh:ks> cqlsh:ks> // By default TTL value of a Column is null #64 cqlsh:ks> insert into student(name, class) values('Bob', '1st'); cqlsh:ks> select class, TTL(class) from student; class | ttl(class) -------+------------ 1st | null (1 rows) cqlsh:ks> cqlsh:ks> // TTL Cannot be retrieved for Primary Key cqlsh:ks> select name, TTL(name) from student; InvalidRequest: Error from server: code=2200 [Invalid query] message="Cannot use selection function ttl on PRIMARY KEY part name" cqlsh:ks> cqlsh:ks> // Specify TTL(for 15 seconds) for a Column cqlsh:ks> update student using TTL 15 set class='2nd' where name='Bob'; cqlsh:ks> select name, TTL(class) from student; name | ttl(class) ------+------------ Bob | 14 (1 rows) cqlsh:ks> select name, TTL(class) from student; name | ttl(class) ------+------------ Bob | null (1 rows) // Note : We do not have any mechanism to provide TTL at row level currently
How to specify TTL(Time to Live) for a Column?
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment