nerdexam
MongoDB

C100DBA · Question #84

Which is the default mode in which the explain() command runs?

The correct answer is C. queryPlanner. queryPlanner (C) is the default mode because it shows MongoDB's query execution plan - which index it would use - without actually running the query. This makes it fast and lightweight for inspecting optimizer decisions. Why the distractors are wrong: A. allPlansExecution - A…

Performance Tuning

Question

Which is the default mode in which the explain() command runs?

Options

  • AallPlansExecution
  • BcustomExecutionStats
  • CqueryPlanner
  • DexecutionStats

How the community answered

(26 responses)
  • A
    4% (1)
  • B
    8% (2)
  • C
    88% (23)

Explanation

queryPlanner (C) is the default mode because it shows MongoDB's query execution plan - which index it would use - without actually running the query. This makes it fast and lightweight for inspecting optimizer decisions.

Why the distractors are wrong:

  • A. allPlansExecution - A valid mode, but it must be explicitly requested; it runs all candidate plans and compares them, which is more expensive.
  • B. customExecutionStats - Not a real mode in MongoDB's explain() API; this option is a distractor.
  • D. executionStats - Also a valid mode, but it actually executes the query and returns runtime stats (docs examined, time taken). You must opt into it explicitly.

Memory tip: Think of the default as "plan only, no action" - queryPlanner just plans, it doesn't execute. If you want real stats, you have to ask for executionStats by name.

Topics

#explain#queryPlanner#execution modes#query diagnostics

Community Discussion

No community discussion yet for this question.

Full C100DBA Practice