cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Maxim Parkachov <>
Subject Re: How to query TTL on collections ?
Date Fri, 21 Jun 2019 12:35:51 GMT
Hi Alain,

thanks a lot for detailed answer.

> You can set values individually in a collection as you did above (and
> probably should do so to avoid massive tombstones creation), but you have
> to read the whole thing at once:

This, actually, is one of the design goals. At the moment I have two
(actually more) "normalised" tables, which have data as separate columns.
But the use case, actually, requires to read all items every time product
is queried, thus move to collection to reduce amount of queries. Moreover,
items in collection is append only and expires using TTL. Map seem to be
excellent fit for that.

> Furthermore, you cannot query the TTL for a single item in a collection,
> and as distinct columns can have distinct TTLs, you cannot query the TTL
> for the whole map (collection). As you cannot get the TTL for the whole
> thing, nor query a single item of the collection, I guess there is no way
> to get the currently set TTL for all or part of a collection.

Yes, this is unfortunate. I could not find a way to query individual
element of collection and TTL for individual element, thanks for confirming
that this is not possible.

> Another idea of hack I'm just thinking about could be to add a 'ttl' field
> that would get the updates as well, any time a client updates the TTL for
> an entry, you could update that 'ttl' field as well. But again, you would
> still not be able to query this information only for an item or a few, it
> would be querying the whole map again.

This is, actually, very good idea, maybe adding field something like
"expires_at" will solve my problem. I received another advise to do it.

For one off query, it is possible to get TTL by finding corresponding
sstable and using sstabledump, it shows all information including TTL, but
this is very cumbersome.


P.S. Your company's blog is excellent.

View raw message