Search code examples
data-modelingcassandra-2.0nosql-aggregationbigdatanosql

Cassandra column family for multiple usecases good/bad


I have a data structure to store different areas/locations, area is part of a city, city is part of a state, state is part of country.

couple of usecases to query are

U1 : Given a location get city, state, country. U2 : Given a Country, State get list of cities, areas

I understand the data to be stored in cassandra should be optimized for the read path.

Key for U1 to be {location, city, state, country}

Key for U2 to be {country, state, city, location}

Would like to know if there is exist a better way other than storing values in two column families


Solution

  • That's the correct way to model, and you can update both tables at once using a logged batch. This is pretty standard modeling. --Ryan Svihla - Solution Architect - datastax