Can any one help me when it is important to use MongoDB Index and where it can be used. Also I need advantages disadvantages of using MongoDB Index?
-
1Possible duplicate of MongoDB Index definition strategykmdreko– kmdreko2018-10-02 05:57:43 +00:00Commented Oct 2, 2018 at 5:57
-
A significant part of university.mongodb.com/courses/M201/about course is about indexing. Give it a try. A detailed answer to this topic can easily reach size of a small book.Alex Blex– Alex Blex2018-10-02 08:41:26 +00:00Commented Oct 2, 2018 at 8:41
Add a comment
|
1 Answer
Can anyone help me when it is important to use MongoDB Index and where it can be used?
- Indexes provide efficient access to your data.
- Without having indexes in place for your queries, the query can scan more number of documents that it is expected to return. Having good indexes in place avoid scanning collections and more documents that what's required to return.
- A well-designed set of indexes that cater the incoming queries to your database can significantly improve the performance of your database.
Also, I need disadvantages of using MongoDB Index
- Indexes need memory and space to store. If the indexes are part of your working set. they will be stored in memory. Meaning that you may need sufficient memory to store indexes in-memory along with frequently accessed data.
- Every update, delete and write operation needs update to the index data structure. Having too many indexes on a collection that involves keys in write, update or delete operation needs update to an existing index. It adds the penalty to write operations.
- Having large number of compound index take more time to restore index in large datasets.