Cassandra - combining multiple tables as a view

Viewed 177

I have 20 tables in Cassandra. For one particular request, I need data from all 20 tables. How can I do this? Can I use a materialized view in Cassandra?

Or should I use Cassandra trigger and make an entry in different table whenever something changes in any of the 20 tables?

Or is there any better way?

1 Answers

The materialized view in Cassandra just maintaining a new table based on the data of the single table, so you can't use this functionality for your purpose. Triggers are also not designed for this kind of work.

So for you, the only the choice is to do a multiple requests to many tables (slow), or maintain a separate table with all data that are necessary for answering this query - this is recommended way in Cassandra, as all table structures are based on the queries.

I recommend to take DS220 course on Data modeling on DataStax Academy

Related