Originally from the User Slack
@Daria_Fedorova: Hi! I am reading on TTL in scylla and one thing seems strange to me
If TTL is only defined for non-primary columns , it is not possible to define TTL for a table that has only primary columns ?
@Felipe_Cardeneti_Mendes: you can have TTL, but you can’t indeed use the ttl()
function on a primary column, yes.
@Daria_Fedorova: do you by any chance know the reason for this ?
@Felipe_Cardeneti_Mendes: I know that historically Cassandra also lacked support for it - since a decade now https://issues.apache.org/jira/browse/CASSANDRA-9312
It’s a bit of an edge case tho. You can’t really update a primary key, so the TTL will always decrease relative to its writetime()
. It is true you can’t use the writetime()
function on a key column, but if that’s a necessary use case, you can easily add a non-key column which simply ingests a now()
timeuuid. Then you can use either the ttl()
function on top of it, or simply deduce from it if you have a fixed TTL