Mixed TTL values in an update statement?

Recreating my system in scylladb with a little bit more paranoia about keeping personal user data. I cant see that this is possible in the documentation, so I am checking here just in case it is possible.

For example, Can we do an insert into a user activity log table, but use different TTL’s for the IP address?

update user_log
set msg='user did something',
      ip='' with ttl=3600
where log_id='ahf9084hg9384hg'

I know we could break this up into two different update statements, but that seems silly due to assumedly triggering two round trips on the network and two write activities.

update user_log using ttl = 1000000
set msg='user did something'
where log_id='ahf9084hg9384hg';

update user_log using ttl = 3600
set ip='' 
where log_id='ahf9084hg9384hg';

It is not possible to specify per-column TTL. They way to achieve this is to use two separate statements. If you don’t want multiple separate round-trips and want to keep the update atomic, you can use a BATCH to bundle the updates into a single one.

1 Like