I’m brand new to Cassandra and I’m having trouble trying to figure out how to order my data. I’m trying to record messages from twitch.tv for each streamer. I want something like the following
CREATE TABLE IF NOT EXISTS chat_data.twitch_chat_by_broadcaster_and_timestamp (
PRIMARY KEY (broadcaster_id, timestamp)
) WITH CLUSTERING ORDER BY (timestamp DESC);
While not an issue for a hobby project, how do you solve the problem of two messages being sent at the exact same time. I’m aware of
TimeUUID, but I want the messages sorted by the timestamp of when they were sent, and it doesn’t look like there are any official ways to create a
TimeUUID other than
I envision using this database for getting all messages in a given time range for a given stream. I realize I could add another
UUID field to guarantee uniqueness, but then that would screw up my query since I have to specify an exact time.
What’s the right way to order this data to allow efficient querying?