DEV Community

Discussion on: Adding Indexes To Mongo + A Case Study

Collapse
 
buinauskas profile image
Evaldas Buinauskas

Out of curiosity. Are indexes in MongoDB global or local?

Collapse
 
stephencweiss profile image
Stephen Charles Weiss

According to DZone, NoSQL is typically local:

By the way, many NoSQL databases like Couchbase Server or MongoDB do local indexing.

Source

That said, this was the first time I had to look into it.

Collapse
 
buinauskas profile image
Evaldas Buinauskas

Pity. I remember looking into Couchbase and it supported global secondary indexes. Thought that MongoDB has caught up.

Thread Thread
 
stephencweiss profile image
Stephen Charles Weiss

Can I ask, how much data are we talking about that you've got a distributed setup and need the global indices?

Thread Thread
 
buinauskas profile image
Evaldas Buinauskas • Edited

I don't really have one. I did quite a lot of research about Cassandra and wanted to have data there for a project but it never worked out.

Project was supposed to be a rewrite of legacy app that had to run in multiple regions and distributed database felt like a natural choice.

Cassandra, like MongoDB had only local Indexes at that time.

Thread Thread
 
stephencweiss profile image
Stephen Charles Weiss

Got it! For what it's worth, I was recently working on projects with ~10m records - I went with Mongo, some peers went with Cassandra. We had comparable query times (post indexing), but the set up of Cassandra was apparently a pain whereas Mongo is a breeze.

Thread Thread
 
buinauskas profile image
Evaldas Buinauskas • Edited

Gee! Cassandra seems like a massive overkill for 10M records. Even MongoDB does, actually.

Also ye, Cassandra requires way more thinking in terms of data modeling and setting up infrastructure, but if done correctly - pays off.