To set TTL on a column only and not on the whole CQL row, use UPDATE
instead:

UPDATE <table> USING TTL xxx SET <column>=<value> WHERE partition=yyy

On Thu, Jul 12, 2018 at 2:42 PM, Nitan Kainth <nitankai...@gmail.com> wrote:

> Kurt,
>
> It is same mentioned on apache docuemtation too, I am not able to find it
> right now.
>
> But my question is:
> How to set TTL for a whole column?
>
> On Wed, Jul 11, 2018 at 11:36 PM, kurt greaves <k...@instaclustr.com>
> wrote:
>
>> The Datastax documentation is wrong. It won't error, and it shouldn't. If
>> you want to fix that documentation I suggest contacting Datastax.
>>
>> On 11 July 2018 at 19:56, Nitan Kainth <nitankai...@gmail.com> wrote:
>>
>>> Hi DuyHai,
>>>
>>> Could you please explain in what case C* will error based on documented
>>> statement:
>>>
>>> You can set a default TTL for an entire table by setting the table's
>>> default_time_to_live
>>> <https://docs.datastax.com/en/cql/3.3/cql/cql_reference/cqlCreateTable.html#tabProp__cqlTableDefaultTTL>
>>>  property. If you try to set a TTL for a specific column that is longer
>>> than the time defined by the table TTL, Cassandra returns an error.
>>>
>>>
>>>
>>> On Wed, Jul 11, 2018 at 2:34 PM, DuyHai Doan <doanduy...@gmail.com>
>>> wrote:
>>>
>>>> default_time_to_live
>>>> <https://docs.datastax.com/en/cql/3.3/cql/cql_reference/cqlCreateTable.html#tabProp__cqlTableDefaultTTL>
>>>>  property applies if you don't specify any TTL on your CQL statement
>>>>
>>>> However you can always override the default_time_to_live
>>>> <https://docs.datastax.com/en/cql/3.3/cql/cql_reference/cqlCreateTable.html#tabProp__cqlTableDefaultTTL>
>>>>  property by specifying a custom value for each CQL statement
>>>>
>>>> The behavior is correct, nothing wrong here
>>>>
>>>> On Wed, Jul 11, 2018 at 7:31 PM, Nitan Kainth <nitankai...@gmail.com>
>>>> wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> As per document: https://docs.datastax.com/en/cql/3.3/cql/cql_using
>>>>> /useExpireExample.html
>>>>>
>>>>>
>>>>>    -
>>>>>
>>>>>    You can set a default TTL for an entire table by setting the
>>>>>    table's default_time_to_live
>>>>>    
>>>>> <https://docs.datastax.com/en/cql/3.3/cql/cql_reference/cqlCreateTable.html#tabProp__cqlTableDefaultTTL>
>>>>>     property. If you try to set a TTL for a specific column that is
>>>>>    longer than the time defined by the table TTL, Cassandra returns an 
>>>>> error.
>>>>>
>>>>>
>>>>> When I tried to test this statement, i found, we can insert data with
>>>>> TTL greater than default_time_to_live. Is the document needs correction, 
>>>>> or
>>>>> am I mis-understanding it?
>>>>>
>>>>> CREATE TABLE test (
>>>>>
>>>>>     name text PRIMARY KEY,
>>>>>
>>>>>     description text
>>>>>
>>>>> ) WITH bloom_filter_fp_chance = 0.01
>>>>>
>>>>>     AND caching = {'keys': 'ALL', 'rows_per_partition': 'NONE'}
>>>>>
>>>>>     AND comment = ''
>>>>>
>>>>>     AND compaction = {'class': 'org.apache.cassandra.db.compa
>>>>> ction.SizeTieredCompactionStrategy', 'max_threshold': '32',
>>>>> 'min_threshold': '4'}
>>>>>
>>>>>     AND compression = {'chunk_length_in_kb': '64', 'class': '
>>>>> org.apache.cassandra.io.compress.LZ4Compressor'}
>>>>>
>>>>>     AND crc_check_chance = 1.0
>>>>>
>>>>>     AND dclocal_read_repair_chance = 0.1
>>>>>
>>>>>     AND default_time_to_live = 240
>>>>>
>>>>>     AND gc_grace_seconds = 864000
>>>>>
>>>>>     AND max_index_interval = 2048
>>>>>
>>>>>     AND memtable_flush_period_in_ms = 0
>>>>>
>>>>>     AND min_index_interval = 128
>>>>>
>>>>>     AND read_repair_chance = 0.0
>>>>>
>>>>>     AND speculative_retry = '99PERCENTILE';
>>>>>
>>>>> insert into test (name, description) values ('name5', 'name
>>>>> description5') using ttl 360;
>>>>>
>>>>> select * from test ;
>>>>>
>>>>>
>>>>>  name  | description
>>>>>
>>>>> -------+-------------------
>>>>>
>>>>>  name5 | name description5
>>>>>
>>>>>
>>>>> SELECT TTL (description) from test;
>>>>>
>>>>>
>>>>>  ttl(description)
>>>>>
>>>>> ------------------
>>>>>
>>>>>              351
>>>>>
>>>>> Can someone please clear this for me?
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>
>>
>

Reply via email to