Secondary Indexes, Materialized Views, and Query Tradeoffs
Understand optional Cassandra query helpers and why they must be used carefully rather than as shortcuts for weak data models.
Inside this chapter
- Why Query Flexibility Is Limited by Design
- Secondary Indexes
- Materialized Views
- Better Mindset: Model for Queries First
Series navigation
Study the chapters in order for the clearest path from beginner Cassandra concepts to advanced distributed operations. Use the navigation at the bottom of each page to move through the full series.
Why Query Flexibility Is Limited by Design
Cassandra intentionally limits arbitrary query flexibility because it is optimized for predictable distributed access patterns. When students come from SQL databases, they often look for ways to “get back” flexible querying. That mindset should be handled carefully.
Secondary Indexes
Secondary indexes exist in Cassandra, but they are not a general substitute for strong primary-key-based modeling. They may help in narrow situations, but can become problematic under high-cardinality or large-scale workloads.
Materialized Views
Materialized views provide alternate query paths derived from a base table. They can be useful, but advanced teams adopt them cautiously because operational behavior and consistency considerations must be understood well.
Better Mindset: Model for Queries First
The strongest Cassandra strategy is still to design specific tables for required queries instead of hoping indexes or views will rescue a weak model later. Query-driven denormalization remains the main discipline.