Indexing in Cassandra
First, a brief history:
– No built-in secondary
– all indexes were custom-built like using supercolumn
– new users flocked to the built-in secondary indexes
pros – easy to use out of the box
cons – not the same as SQL indexes but they look similar
– reinforce data modeling that plays *against* cassandra’s strengths
– new users can get started with Cassandra w/out understanding internals, using CQL
– Veteran users are using advanced techniques like composites that aren’t really documented anywhere.
– New user panic mode when they try to use the next level and find themselves in the deep end.
Quick review of Indexing
2 ways of finding rows – primary index and alternate indexes
primary index (row keys):
– sometimes it’s meaningful (natural key)
– usually not, like a uuid
Get vs. find:
using row key is best to retrieve info if you’ve got precise and immutable 1:1 mapping
if you plan to iterate over keys, you’re probably doing something wrong. (that’s finding, not getting)
So search shouldn’t really use primary keys, just ‘get’.
alternate indexes (everything else)
Jira entry on this:
Interested in working with Jon? Schedule a tech call.