![]() ![]() Without indexing, the operations become expensive since a lot of documents need to be scanned through before applying the changes. After identifying these queries, we use the explain helper on these queries to get more details for example if the query is using any index. One can identify slow queries in MongoDB by enabling the profiler and configuring it to its some specifications or executing db.currentOp() on a running mongod instance.īy looking at the time parameters on the returned result, we can identify which queries are lagging. If you want to learn more about indexing and which indexing strategy to use, check on this blog Conclusionĭatabase performance degradation can be easily portrayed by having slow queries which is the least expectation we would want platform users to encounter. Where quantity is an example field you have selected to be optimal for the indexing strategy. To set the profiling, we use the db.setProfilingLevel() helper such as: db.setProfilingLevel(2)Ī sample document that will be stored in the system.profile collection will be: ) One should consider any performance implications before enabling and configuring the profiler on a production deployment. However, enabling profiling generates a performance impact on the database and disk usage especially when the profiling level is set to 2. 2- the profiler collects data for all operations.1 – the profiler collects data for operations that take longer than the value of slowms. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |