MongoDB Advanced Explain: Aggregation, Sharded Plans, Loose Index Scans and the 8.3 Cost-Based Ranker

Parent: MongoDB Explain Plans, Query Planner and Plan Cache · Published reference · snapshot 2026-10-19 · skill mongodb-expert/references/mongodb-advanced-explain-and-planner-changes.md

Also known as: $group $first Loose Index Scan (DISTINCT_SCAN for sort-group-first), Aggregation Explain and Spill Statistics ($lookup and $group and memory limits), Aggregation explain and $lookup/spill stats, Aggregation pipeline explain and $lookup visibility, Aggregation split pipelines and merge shard selection, Cost-Based Ranker and Multi-Planning Changes (8.3 and 9.0), Cost-based ranker (8.3), Cost-based ranker and multi-planning in 8.3, Last-point queries and DISTINCT_SCAN, Last-point query DISTINCT_SCAN, Per-operation memory limit tuning, Query knobs (9.0), Sharded Explain and Split Pipelines (SHARD_MERGE and per-shard stats and merge shard selection), Sharded explain (SHARD_MERGE, per-shard stats), Slow in-progress query logging (8.3), Sort-group-$first loose index scan, queryStats output schema in 9.0

↓ Facts as markdownall context files

Advanced explain output covers spill statistics for blocking aggregation stages (usedDisk, spilledBytes and the per-stage memory limit), sharded plans (SHARD_MERGE, splitPipeline with shardsPart and mergerPart, mergeType), the $sort+$group $first loose index scan that explain reports as DISTINCT_SCAN, and the 8.3 cost-based ranker with its costEstimate and cardinalityEstimate fields. Compiled from MongoDB manual and JIRA pages plus the run's verified claims.

These notes link each claim to its source. Some citations identify archived research reports that are no longer hosted on this site. A published reference means the content is available; it does not certify independent review or accuracy.Read the editorial policy and follow the sources before relying on a claim.

Definitions

Structure and components

How it works

How-to and procedures

Examples and snippets

Problems, failure modes and limitations

Comparisons and alternatives

Facts and statements

Related concepts

Children

Frontier under this node: $groupByDistinct internal stage, SBE $lookup pushdown and hash join (3.10), queryKnobs and per-command querySettings (2.65)

← the whole tree · 3D view· how to read this page