I need to get a list of N users with the most recent actions using cassandra.
I have tried to use the following schema:
CREATE TABLE user_actions(
partition_key int,
username int,
action_time timestamp,
PRIMARY KEY(partition_key, action_time)
WITH CLUSTERING ORDER BY(action_time DESC);
When a user first logs in it creates a new entry. However, I'm unable to update the start_time
property as it's used as a clustering key.
I could delete the old data and create a new entry when the user takes another action - but user actions occur frequently and we will quickly hit the tombstone limit.
Does anyone know how best I could model the data in order to achieve this?