Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Learning Apache Cassandra
  • Toc
  • feedback
Learning Apache Cassandra

Learning Apache Cassandra

By : Brown
4.4 (13)
close
Learning Apache Cassandra

Learning Apache Cassandra

4.4 (13)
By: Brown

Overview of this book

If you're an application developer familiar with SQL databases such as MySQL or Postgres, and you want to explore distributed databases such as Cassandra, this is the perfect guide for you. Even if you've never worked with a distributed database before, Cassandra's intuitive programming interface coupled with the step-by-step examples in this book will have you building highly scalable persistence layers for your applications in no time.
Table of Contents (14 chapters)
close
13
Index

Fully denormalizing the home timeline


The partially denormalized structure we built using the home_status_update_ids table certainly improves read-time performance, but we're still not at the sweet spot of querying exactly one partition to display the home timeline. In order to do this, we'll need to take the denormalization one step further.

Instead of storing references to status updates in the home timeline, we'll store actual copies of the status updates. Each user's timeline will contain its own copy of the status updates of all the users they follow. We create the following table:

CREATE TABLE "home_status_updates" (
  "timeline_username" text,
  "status_update_id" timeuuid,
  "status_update_username" text,
  "body" text,
  PRIMARY KEY ("timeline_username", "status_update_id")
) WITH CLUSTERING ORDER BY ("status_update_id" DESC);

This table looks very much like the home_status_update_ids table, except it contains an additional body column. By adding body, we now have a table that will...

Unlock full access

Continue reading for free

A Packt free trial gives you instant online access to our library of over 7000 practical eBooks and videos, constantly updated with the latest in tech
bookmark search playlist font-size

Change the font size

margin-width

Change margin width

day-mode

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Delete Bookmark

Modal Close icon
Are you sure you want to delete it?
Cancel
Yes, Delete