Reputation: 8580
Trying to learn how cassandra works here, was very hard to get insights about how data is stored behind the scenes, hence im not sure i got it right and wanted to get corrected if i got it wrong, so far i understand that a typical row that the partition key (leftmost column or compuond column in the primary key) is unique, a row would be written to disk in a chunk that looks like this :
where the columns are sorted by their names.
But, if the partition key is not unique for then it would be considered a "wide row" and a row would look like the following examples :
Please correct me if i got it wrong...
Upvotes: 2
Views: 79
Reputation: 6218
For Second part where you have compound primary key the structure will be somthing similar to first except for the fact that:
ColumnName will be replaced by usrname1.comments|username1.comments_ts|username2.comments|username2.comments_ts
VideoId : usrname1.comments|username1.comments_ts|username2.comments|username2.comments_ts
Same thing will be true for comments_by_user
username: videoid1.comments|videoid1.comments_ts|videoid2.comments|videoid2.comments_ts
PS: I am not good at drawing images so you have to do with this text answer.
For more details Refer Slide 48
Upvotes: 2