Chapter 5. Data Modeling

The data model you use is the most important factor in your success with Cassandra.

Patrick McFadin

More than any configuration or tuning you can perform, your data model is the main factor that will affect your application performance and cluster maintenance. In this chapter, you’ll learn how to design data models for Cassandra, including a data modeling process and notation. To apply this knowledge, you’ll design the data model for a sample application, which you’ll build over the next several chapters. This will help show how all the parts fit together. Along the way, you’ll see some tools to help you manage your CQL scripts.

Conceptual Data Modeling

First, let’s create a simple domain model that is easy to understand in the relational world, and then see how you might map it from a relational to a distributed hash table model in Cassandra.

To create the example, we want to use something that is complex enough to show the various data structures and design patterns, but not something that will bog you down with details. Also, a domain that’s familiar to everyone will allow you to concentrate on how to work with Cassandra, not on what the application domain is all about.

Let’s use a domain that is easily understood and that everyone can relate to: making hotel reservations.

Our conceptual domain includes hotels, guests that stay in the hotels, a collection of rooms for each hotel, the rates and availability of those rooms, and a record of reservations ...

Get Cassandra: The Definitive Guide, 3rd 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.