Skip to main content

How do you diagnose performance issues using MongoDB’s profiler?

Senior MongoDB
Quick Answer MongoDB profiler records query execution details to system.profile. Enable with db.setProfilingLevel(1, {slowms: 100}) to capture queries over 100ms. Analyze: look at millis (execution time), nscanned vs nreturned (high ratio = bad index), keysExamined, and the queryPlanner stage. Atlas Profiler provides this in a UI. Regularly review slow query logs in production.

Answer

The profiler captures slow queries, execution times, scan metrics, and index usage, helping identify unindexed operations, inefficient sorts, and pipeline bottlenecks.
S
SugharaIQ Editorial Team Verified Answer

This answer has been peer-reviewed by industry experts holding senior engineering roles to ensure technical accuracy and relevance for modern interview standards.

Want to bookmark, take notes, or join discussions?

Sign in to access all features and personalize your learning experience.

Sign In Create Account

Source: SugharaIQ

Ready to level up? Start Practice