TTL indexed secondary

I need to expire data using a TTL with a table that uses a secondary index. How to remove data that currently expires using a TTL, but is unable to do due to the need for a secondary index?

Help anyone
Thanks
Zaid explore

Hi @zaidmd

The problem is that indexes won’t be consistent. See issue on github: [YCQL] Disallow inserts on tables with default_ttl + secondary index. · Issue #6325 · yugabyte/yugabyte-db · GitHub

Maybe you can keep an “expire_at” column and periodically delete rows ?

Hi @zaidmd,

I am assuming you are using YCQL, since only that API supports TTL.

Are you ok with using user_enforced consistency level? See details here: Document details of user enforced consistency · Issue #1696 · yugabyte/yugabyte-db · GitHub

If so, you can set a TTL on the primary table and the different indexes - and they would all get TTL’ed separately. Does that work for you?