MAX(), DISTINCT and group by in Cassandra

With Cassandra you solve these kinds of problems by doing more work when you insert your data — which sounds like it would be slow, but Cassandra is designed for fast writes, and you’re probably going to read the data many more times than you write it so it makes sense when you consider the whole system.

I can’t tell you exactly how to create your tables to model your problem because it will depend a lot on the details. You need to figure a schema that lets you get the data without performing any on-the-fly aggregations. Think about how you would create views for the queries in an RDBMS, and then try to think how you would insert data directly into those views, not into the underlying tables. That’s kind of how you model things in Cassandra.

Leave a Comment