I am having a slowness in my insert statements when working with MongoDB, and when I did a quick investigation, I though this might happened because the table has 11 indexes. Plus, I know that when I insert one record on a table having some indexes, the database has to update all relative indexes before informing me that insertion is completed, but my question is:

Why is the database will inform me that the insert/update statement is completed after all indexes are also inserted or updated?, why not insertion to main table will be enough and the indexes will be updated later (with different thread for example!?.

I wish my question is clear enough, help please :)


1 Answer 1


You can use $indexStats to debug if all indexes are in use to delete some og them and speed up the inserts:

db.collection.aggregate( [ { $indexStats : { } } ] ).pretty()

More info: indexStats


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.