In this chapter, we looked at ways to model relationships between objects that go beyond the straightforward parent-child relationships, which are captured elegantly by a compound primary key. We found that query-driven schema design motivated us to create multiple representations of the follow relationship; each representation was optimized to answer a specific question about follows. This led us to a denormalized schema, wherein each follow has multiple representations in our database.
While our denormalized schema requires more write operations than a normalized one and extra care at the application level to ensure the different representations of follows are consistent with one another, we end up with a better overall performance because writing data to Cassandra is cheaper than reading it. By designing our schema to allow Cassandra to efficiently access data in a single partition to answer any question...