You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Kevin Burton <bu...@spinn3r.com> on 2015/08/05 04:22:33 UTC

TTLs on tables with *only* primary keys?

I have a table which just has primary keys.

basically:

create table foo (

    sequence bigint,
    signature text,
    primary key( sequence, signature )
)

I need these to eventually get GCd however it doesn’t seem to work.

If I then run:

select ttl(sequence) from foo;

I get:

Cannot use selection function ttl on PRIMARY KEY part sequence

…

I get the same thing if I do it on the second column .. (signature).

And the value doesn’t seem to be TTLd.

What’s the best way to proceed here?


-- 

Founder/CEO Spinn3r.com
Location: *San Francisco, CA*
blog: http://burtonator.wordpress.com
… or check out my Google+ profile
<https://plus.google.com/102718274791889610666/posts>

Re: TTLs on tables with *only* primary keys?

Posted by Kevin Burton <bu...@spinn3r.com>.
Thanks. This is what I was looking for…

I ended up working around this by using a boolean field as a column.
Wastes a bit of space but its not the end of the world.

On Wed, Aug 5, 2015 at 7:33 AM, Tyler Hobbs <ty...@datastax.com> wrote:

> You can set the TTL on a row when you create it using an INSERT
> statement.  For example:
>
> INSERT INTO mytable (partitionkey, clusteringkey) VALUES (0, 0) USING TTL
> 100;
>
> However, Cassandra doesn't support the ttl() function on primary key
> columns yet.  The ticket to support this is
> https://issues.apache.org/jira/browse/CASSANDRA-9312.
>
> On Tue, Aug 4, 2015 at 9:22 PM, Kevin Burton <bu...@spinn3r.com> wrote:
>
>> I have a table which just has primary keys.
>>
>> basically:
>>
>> create table foo (
>>
>>     sequence bigint,
>>     signature text,
>>     primary key( sequence, signature )
>> )
>>
>> I need these to eventually get GCd however it doesn’t seem to work.
>>
>> If I then run:
>>
>> select ttl(sequence) from foo;
>>
>> I get:
>>
>> Cannot use selection function ttl on PRIMARY KEY part sequence
>>
>> …
>>
>> I get the same thing if I do it on the second column .. (signature).
>>
>> And the value doesn’t seem to be TTLd.
>>
>> What’s the best way to proceed here?
>>
>>
>> --
>>
>> Founder/CEO Spinn3r.com
>> Location: *San Francisco, CA*
>> blog: http://burtonator.wordpress.com
>> … or check out my Google+ profile
>> <https://plus.google.com/102718274791889610666/posts>
>>
>>
>
>
> --
> Tyler Hobbs
> DataStax <http://datastax.com/>
>



-- 

Founder/CEO Spinn3r.com
Location: *San Francisco, CA*
blog: http://burtonator.wordpress.com
… or check out my Google+ profile
<https://plus.google.com/102718274791889610666/posts>

Re: TTLs on tables with *only* primary keys?

Posted by Tyler Hobbs <ty...@datastax.com>.
You can set the TTL on a row when you create it using an INSERT statement.
For example:

INSERT INTO mytable (partitionkey, clusteringkey) VALUES (0, 0) USING TTL
100;

However, Cassandra doesn't support the ttl() function on primary key
columns yet.  The ticket to support this is
https://issues.apache.org/jira/browse/CASSANDRA-9312.

On Tue, Aug 4, 2015 at 9:22 PM, Kevin Burton <bu...@spinn3r.com> wrote:

> I have a table which just has primary keys.
>
> basically:
>
> create table foo (
>
>     sequence bigint,
>     signature text,
>     primary key( sequence, signature )
> )
>
> I need these to eventually get GCd however it doesn’t seem to work.
>
> If I then run:
>
> select ttl(sequence) from foo;
>
> I get:
>
> Cannot use selection function ttl on PRIMARY KEY part sequence
>
> …
>
> I get the same thing if I do it on the second column .. (signature).
>
> And the value doesn’t seem to be TTLd.
>
> What’s the best way to proceed here?
>
>
> --
>
> Founder/CEO Spinn3r.com
> Location: *San Francisco, CA*
> blog: http://burtonator.wordpress.com
> … or check out my Google+ profile
> <https://plus.google.com/102718274791889610666/posts>
>
>


-- 
Tyler Hobbs
DataStax <http://datastax.com/>