Database Reference
In-Depth Information
Our proposed answer is as follows:
// Time series wide row with reverse comparator
CREATE TABLE video_event (
videoid uuid,
username varchar,
event varchar,
event_timestamp timeuuid,
video_timestamp bigint,
PRIMARY KEY ((videoid,username), event_timestamp,event)
) WITH CLUSTERING ORDER BY (event_timestamp DESC,event ASC);
Again, let's play with the data, so that we get a feel of what's going on.
To generate the data for your testing, run the following script in the topic's code
(please refer to our repository for instructions on how to run this script):
./generate_video_events.sh 5 10
Then, import the data into HBase using Phoenix.
The following is the sample data content that you might see:
Now that you have designed the solution and run the lab with the actual data, here
are the points to be noted for this design:
video_timestamp is not part of the row key. Therefore, all video_timestamp
entries go into the same row, in effect forming a wide row, where you can get
all the events for a given video and user in one query.
• Can you determine the size of the table at which the performance
deteriorates?
• Our solution will be very slow for large table sizes, so what is your
proposed solution?
 
Search WWH ::




Custom Search