Database Reference
In-Depth Information
month and each partition has only one month worth of records. This will solve
both the problems: the cap on the number of records and the hotspot issue.
However, we will still need a way to order buckets. For this example, we will
have all the posts in one partition just to keep things simple. We will tackle the
bucketing issues in Chapter 3 , Effective CQL . The following figure shows how to
write time series grouped data using composite columns:
comments : They have a similar property as post, except it is linked to a post in-
stead of being linked to a blog.
tags : They are a part of post. We use the Set data type to represent tags on the
posts. One of the features that we mentioned earlier is to be able to search posts
by tags. The best way to do it is to create an index on the tags column and make
it searchable. Unfortunately, index on collections data types has not been suppor-
ted until Cassandra Version 2.1 ( https://issues.apache.org/jira/browse/
CASSANDRA-4511 ) . In our case, we will have to create and manage this sort of
indexing manually. So, we will create a tags table that will have a compound
primary key with tag and blog ID as its components.
counters : Ideally, you would think that you want to put upvote and downvote
counters as a part of the posts and comments tables' column definition, but
Cassandra does not support a table that has a counter type column(s) and some
other type column unless the counter is a part of the primary key definition. So, in
our case, we will create two new tables just to keep track of votes.
With this, we are done with data modeling. The next step is inserting and getting data
back.
Search WWH ::




Custom Search