cql - Cassandra Timestamp+Counter -
How do I want to create some models in CASADRA at present
what do i want is:
table calculations (user varchar, last_event timestamp, event_count counter, primary key (user));
The goal here is to store those two pieces of data (event_count and last_event) the way a user can be efficiently retrieved.
In addition to this, there are many threads to write this data at the same time, the counter type, which handles that case well, is quite useful.
However, I know that it is impossible to add a counter and a timestamp in it. The only table is there any other, alternate way for this data to work, which can work?
I realize that I can store all events as my own rows, but we should be able to get last and effective last_vanced event_count for a given user
Edit for clarity: I have a stream of timestamps associated with users. I want to store the number of timestamps and the most recent timestamps for each user, and I want to optimize for a quick look for a particular user.
Just type your primary key (user, timestamp)
. This will be a separate partition for each user and the final event timestamp of each counter will be ordered in the partition.
table calculations (user varchar, last_event timestamp, event_count counter, primary key (user, last_evolution));
Your split will appear
[username - & gt; [Time 1, Counter], [Time 2, Counter] ....]
Edit:
There are several solutions to the updated question. I think the easiest way to do this is with two tables.
Create a UIID to avoid event_data collosions for the previous events (user varchar, event timewid, // timeline, // whatever you past event's primary user (user, event) ), The table is responsible for tracking the events in a timely fashion.
Selecting from this table in the descending order of the time table will allow us to retrieve the most recent events. We keep it from different state information that we put in the next table Create table events tools (user varchar, event count counter, primary key (user))
This event is just a lookup between the user and how many incidents happened for the said user.
You can update these two tables at the same time in your application.
Comments
Post a Comment