<!-- llms-explorer concept facts · https://llms-explorer.com/tree/explain-verbosity-modes/ · pack 2026-10-20 · ~1085 tokens -->

# Explain verbosity modes

> Source-anchored research for Explain verbosity modes. Run status: COMPLETED.

Parent: [MongoDB Query Optimization Tooling: Compass Explain, Atlas Query Insights and Performance Advisor](https://llms-explorer.com/tree/mongodb-query-optimization-tooling-compass-explain-atlas-query-insights-and-performance-advisor/) · 4 facets · 10 facts · page: https://llms-explorer.com/tree/explain-verbosity-modes/

## Structure and components

- MongoDB provides three explain verbosity modes: `queryPlanner`, `executionStats`, and `allPlansExecution`. The selected mode determines whether output contains completed execution statistics and whether it includes plan-selection trial data. (high confidence) — [source](https://www.mongodb.com/docs/v8.3/reference/command/explain/)

## How it works

- The database `explain` command defaults to `allPlansExecution`, while mongosh `cursor.explain()` and `db.collection.explain()` default to `queryPlanner`. Passing the verbosity explicitly avoids different output when moving between the command and helper methods. (high confidence) (verified as of 2026-10-14) — [source](https://www.mongodb.com/docs/manual/reference/command/explain.md)

## How-to and procedures

- Use `queryPlanner` to inspect the winning plan structure and considered alternatives. Use `executionStats` to assess the completed winning plan with counters such as `nReturned`, `totalKeysExamined`, and `totalDocsExamined`. Use `allPlansExecution` when candidate-plan trial results are needed; the rejected candidates' execution data is partial. (high confidence) — [source](https://www.mongodb.com/docs/manual/reference/method/cursor.explain.md)

## Facts and statements

- `queryPlanner` returns planner information without the completed `executionStats` section. `executionStats` executes the winning plan to completion and adds full-run statistics. `allPlansExecution` includes that winning-plan data plus partial plan-selection statistics for candidate plans, including rejected plans. Those candidate figures are trial data, not completed-query totals. (high confidence) (verified as of 2026-10-14) — [source](https://www.mongodb.com/docs/manual/reference/command/explain.md)
- MongoDB Compass's Explain Plan modal presents a visual plan tree and a query-performance summary with winning-plan counters such as documents returned, documents examined, and index keys examined; Raw Output exposes the JSON explain details. (medium confidence) (verified as of 2026-10-19) — [source](https://www.mongodb.com/docs/manual/tutorial/analyze-query-plan/)
- Do not treat `executionStats.executionTimeMillis` as a direct measure of application latency. Explain ignores existing plan-cache entries and does not cache the winning plan; the reported time includes plan selection and query execution but excludes network transmission, so steady-state cached queries can complete faster. (high confidence) (verified as of 2026-10-14) — [source](https://www.mongodb.com/docs/v8.3/reference/explain-results/)
- `queryPlanner` runs the query optimizer and returns planning information for the evaluated operation, including its winning plan and rejected plans. It does not return completed `executionStats` for the winning plan. (high confidence) — [source](https://www.mongodb.com/docs/v8.3/reference/command/explain/)
- `executionStats` runs the optimizer-selected winning plan to completion and adds execution counters such as `nReturned`, `totalKeysExamined`, and `totalDocsExamined`. For write operations, explain reports the changes that would occur without applying them to the database. (high confidence) — [source](https://www.mongodb.com/docs/v8.3/reference/command/explain/)
- `allPlansExecution` returns completed execution statistics for the winning plan plus candidate-plan statistics captured during plan selection. Candidate-plan trial data is not equivalent to full-completion statistics for every rejected plan. (high confidence) — [source](https://www.mongodb.com/docs/v8.3/reference/command/explain/)
- MongoDB does not allow `executionStats` or `allPlansExecution` explain for an aggregation pipeline containing `$out`; run `queryPlanner` or explain the stages before `$out` instead. (high confidence) (verified as of 2026-10-20) — [source](https://www.mongodb.com/docs/v8.3/reference/command/explain/)
