Cassandra Materialized view vs Index


Cassandra, it's not new now, mostly all developer should know it somehow or might read some where.

if you are not part of this big data column base database development usage then grab it and learn it for your next scaling problem at data level, what you are or you would face in project work :) this help you !!!

Today, let's me give you detail about cassandra materialised view (new feature in 3.0 cassandra) and how it's work.

Also, how it's defer than apply index on column in your single data model table.

Real life issue with cassandra :


  • Data model best practice  suggest you to make read faster, use query base data model, do not worry about write or duplicate of data at the cassandra level, it can be handle by your application
  • But, it's not easy to handle this at application level when we simple change one or few row and it's effect to update many data model even if it's part of one entities or one record object.
What was solution pre cassandra 3.0 
  • Cassandra community has answer either build query base data model mean each query execution should have one table in cassandra so read operation become faster.
  • Another quick solution if you wont like above approach 
    • use concept of index on query column and use single table in data model (fun) 
    • fun behind this, application need to write and maintain the single table in cassandra side for all CRUD operation. - here you are thinking for better write , not read :(
What was post cassandra 3.0 

  • Cassandra(indirectly datastak might be) introduce the concept of Materialise view .
  • More info : link
Let's understand simple example : 



Here, how would you make cql.

Here, How you can get same thing with Local Indexes  ?


How does it hit at node level in cluster env.  ?


 Since Index column is not partition key, it has to hit all nodes in your cluster env.


Problem : it would hit your performance but if you are looking for predicate base query or application does not know which column query got execute then it's OK also it's ok if you are looking for fulltext search functionality, you dont have any option as of now :).

Let's see how does it help here ?


Since Cassandra managed partition key or create partition key while making the materialized views,
it wont be talk with all your nodes but only which has real your result data :)


Let's quick look, how does it compare and who will WIN.

Enjoy and keep using the cassandra  for your product .

thanks to apache cassandra & datastak.

 

Comments

Popular posts from this blog

Simple way producer–consumer problem's implementation in NodeJs

Step by step guide on how to pay Income Tax that is due