Reputation: 11737
I'm reading about Mongodb's indexes for my Mongodb project
I am well aware that inserting data into a traditional relation database would cause a large slow down if the table was very large as the indexes are rebuilt.
If I choose to add indexes to Mongodb collections: Is rebuilding an index in Mongodb roughly as expensive as rebuilding an index in a traditional relational database? or does the fact that it uses a B-Tree for indexing improve rebuild time?
Upvotes: 2
Views: 4027
Reputation: 1964
In MongoDB, as in other RDMBS, once you build an index, subsequent inserts, deletes, and updates will be slowed down.
The process of rebuilding is handled by MongoDB itself, but you can force a manual rebuild using db.myCollection.reIndex()
.
Upvotes: 3
Reputation: 96266
Rebuilding an index is just as expensive in Mongodb.
Note: traditional databases also use B-Trees.
Upvotes: 0