Answering the right question

Recall that the job of this table is to be able to answer questions such as - How many total status update views happened on each day of September? In order to do so, we need to store view counts aggregated daily, and we need to be able to query for ranges of days.

By forming a primary key out of the year, month, and day on which the views were counted, we aggregate at the right granularity: there will be one row per day, containing the counts for that day. We use the year of the observation as the partition key, thus giving ourselves the ability to retrieve a series of daily counts for any range of days within the same year. In the event that we want to retrieve a series of daily counts for a range that spans ...

Get Learning Apache Cassandra - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.