1

At blog I see below statement

Secondary Indexes

Secondary indexes are a first-class construct in MongoDB. This makes it easy to index any property of an object stored in MongoDB even if it is nested. This makes it really easy to query based on these secondary indexes Cassandra has only cursory support for secondary indexes. Secondary indexes are also limited to single columns and equality comparisons. If you are mostly going to be querying by the primary key then Cassandra will work well for you.

My question is can't Cassandra create more than one secondary index on separate columns ?

Also can't we execute operation like or full text search on Cassandra as it says secondary index are good for only equality comparison

Update :- What is the difference between cassandra secondary index and Mongo secondary index ?

emilly
  • 10,060
  • 33
  • 97
  • 172

1 Answers1

1

Cassandra create more than one secondary index on separate columns ?

Yes it can. Multiple Indexes are possible but ALLOW FILTERING must be used to query, which affects the performance. Secondary index in cassandra are not like the one in RDBMS and proper analysis should be done before using it.

can't we execute operation like or full text search on Cassandra as it says secondary index are good for only equality comparison

Normal Secondary index does not support like operation. Though latest cassandra version (3.x) has support for SASI Index which has support for like or CONTAINS operation.

Custom SASI Index

undefined_variable
  • 6,180
  • 2
  • 22
  • 37
  • well if we can create the multiple secondary index with ALLOW FILTERING which impacts the performance then what is the use of creating multiple index ? Also can you please elaborate how secondary index in cassandra different than RDBMS or Mongo ? – emilly Jan 15 '18 at 10:10
  • Regarding like you are right index will not support like provided if wildcard is at beginning like '%test%' otherwise it should support – emilly Jan 15 '18 at 10:11
  • Multiple indexes can be used if you are querying by partition key... cassandra is distributed system if you are only querying by secondary index it has to go to each node to look for particular value... hence causing performance issue – undefined_variable Jan 15 '18 at 10:13
  • `cassandra is distributed system if you are only querying by secondary index it has to go to each node to look for particular value` Well I am bit confused now. I believe like any distributed store(For example :- Mongo), data is partitioned based on some key say product type. Now for product type electronics data will be stored on particular node. Now if we query on any column(with secondary index created on it) along with partition key then query will go to specific node not all the nodes. I believe same is true for cassandra also. Is n't it ? – emilly Jan 15 '18 at 10:31
  • 1
    yes... that's the reason I said `Multiple indexes can be used if you are querying by partition key`... but consider scenario `where secondary_index_col='something'` this will go to all nodes – undefined_variable Jan 15 '18 at 13:01