Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CREATE TABLE IF NOT EXISTS logstv.messages (
- timestamp timestamp,
- channelid bigint,
- userid bigint,
- message text,
- PRIMARY KEY ((channelid, userid), timestamp)
- ) WITH CLUSTERING ORDER BY (timestamp DESC);
- Random Algorithm:
- - ORDER BY DESC/ASC (2 queries) and find last and first ever message
- - Generate random month in go between the 2 dates
- - SELECT the months messages
- - If zero messages, generate a new random month and SELECT that one. (Recursive) Stop when all Months between last and first message have been checked
- - Count rows in selected months and do a random on that
Advertisement
Add Comment
Please, Sign In to add comment