0

I want to mark an entire existing row (not a column) for deletion using a TTL.

Unfortunately the TTL will only remove the entire row if it was set during insertion of the row. If you "update" the row and add a TTL, it will only effect the specific columns which were updated , and you can't "update" the primary key.

Is there some sort of work around? Am I forced to read the full row and then "re-insert" it to the table, adding the TTL value?

Avba
  • 14,822
  • 20
  • 92
  • 192

1 Answers1

1

You can't update TTL on an entire row. To do so, you need to re-insert with new TTL.

Check out This link on: Just set the TTL on a row

MD Ruhul Amin
  • 4,386
  • 1
  • 22
  • 37
  • so what is the suggested way to solve this problem? I have to write the full row again? (read and then write) or is there a design pattern to do it more efficiantly (create a side table or "stored procedure") – Avba Apr 02 '18 at 10:27
  • > I have to write the full row again? Yes, all of the column's ttl you want to update. AFAIK, this is the way to do it. It's because the way Cassandra is designed. C* doesn't store it's entire row altogether and it checks TTL of corresponding columns while you are going to read it. – MD Ruhul Amin Apr 02 '18 at 10:35