cassandrascylla

Large TTL for expiring records in Scylla/Cassandra?


I have an use-case where I need to delete the records from Scylla table after 18 months. Is it advisable to put a large default_time_to_live in Cassandra/Scylla tables? The table grows at ~2M records/day.

Sample table:

CREATE TABLE heartrate_ttl (
    pet_chip_id  uuid,
    name text,
    heart_rate int,
    PRIMARY KEY (pet_chip_id))
WITH default_time_to_live = 47304000;

Solution

  • TL;DR;

    An 18 month TTL should work just fine for the next 12.5 years.

    Long version

    The current MAX_TTL is defined in the source as 20 * 365 * 24 * 60 * 60; 20 years. However, at the time of this writing Cassandra TTLs are still subject to The Year 2038 Problem. For a TTL of 18 months, this means that write operations will begin failing on 2036-07-01 at 03:14:07

    For those considering extremely large TTLs, I highly recommend reading through CASSANDRA-14092 and CASSANDRA-14227.