Other uses of secondary indexes

We've seen that secondary indexes neatly allow us to turn a denormalized relationship structure into a normalized one: the user_follows table is able to answer all the important questions about follow relationships without any duplication of data. This is but one of the many use cases for which secondary indexes are well suited.

Secondary indexes are best suited for low-cardinality columns, that is, columns that contain the same value for many rows. An example might be a location column on the users table; if this is restricted to city and state, many users will share the same location. In fact, we will add a location column to the users table in the Adding columns to tables section in Chapter 7, Expanding ...

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.