A standard approach in a relational database would include executing a SELECT, ordering with some temporary code identifier, so that the newest row would be returned first, so you could see if this matches your last "last row" and define a change-in cassandra, that will not work, because without a WHERE clause, the results are ordered by a section token, which (almost certainly) is random.
So the solution is to create a table in which there is a section where users are sorted in a specific section. For instance:
CREATE TABLE user_buckets ( bucket text, user_timestamp timeuuid, user_username text, PRIMARY KEY(bucket, user_timestamp) ) WITH CLUSTERING ORDER BY (user_timestamp DESC);
In this case, you should write both in the users table and in the user_buckets table, and "bucket" is something reasonable (for example, date (YYYY)), where each section contains all registered users this year or date (YYYYMMDD) - where each section contains all registered users that day), and then use SELECT ... FROM user_buckets WHERE bucket = (current-bucket) AND user_timestamp> (the last timestamp you saw).
source share