https://docs.mongodb.com/manual/reference/method/db.setProfilingLevel/ is the first place, where I knew, I can do something. The below snippet allowed me to test & verify the efforts quickly.
db.setProfilingLevel(0)
db.system.profile.drop()
db.setProfilingLevel(1, 100); //100, 500, 1000, 2000
db.system.profile.find({}, {query: 1, ns: 1, millis: 1}).limit(10).sort( { millis : -1 } ).pretty()
Query explainer: db.collection.find(query).explain('executionStats');
Learnt complex/compound queries can make use of individual indexes.
Available indexes & their sizes can be seen using db.collection.stats()
mongotop
a neat tool.
Hopefully, this would be a real optimization.
Note to self:
- Keep an eye on index size
- Try to rewrite logic & incorporate optmization at design level. So, the queries will be faster with only default and simple indexes.
Congratulations @mudivili! You received a personal award!
Click here to view your Board
Congratulations @mudivili! You received a personal award!
You can view your badges on your Steem Board and compare to others on the Steem Ranking
Vote for @Steemitboard as a witness to get one more award and increased upvotes!