<!-- llms-explorer concept facts · https://llms-explorer.com/tree/targeted-vs-scatter-gather-shard-routing-in-explain/ · pack 2026-10-21 · ~1083 tokens -->

# Targeted vs scatter-gather shard routing in explain

> Source-anchored research for Targeted vs scatter-gather shard routing in explain. Run status: COMPLETED.

Parent: [MongoDB Advanced Explain: Aggregation, Sharded Plans, Loose Index Scans and the 8.3 Cost-Based Ranker](https://llms-explorer.com/tree/mongodb-advanced-explain-aggregation-sharded-plans-loose-index-scans-and-the-8-3-cost-based-ranker/) · 6 facets · 9 facts · page: https://llms-explorer.com/tree/targeted-vs-scatter-gather-shard-routing-in-explain/

## Definitions

- A predicate that mentions a shard-key field is not by itself proof of targeted routing: compound shard keys require a usable leading prefix, and MongoDB's current routing manual says some queries that include the shard key can still broadcast depending on data distribution and selectivity. (medium confidence) (verified as of 2026-10-19) — [source](https://www.mongodb.com/docs/manual/core/sharded-cluster-query-router/)

## Structure and components

- In MongoDB 8.3 explain output for a sharded collection, queryPlanner.winningPlan.shards lists each accessed shard with its planner information, and executionStats.shards contains execution statistics for each accessed shard. The shard names identify which shards participated in the operation. (high confidence) (verified as of 2026-10-20) — [source](https://www.mongodb.com/docs/v8.3/reference/explain-results/)
- For aggregation explain, mergeType identifies where the merge happens, splitPipeline shows which operations run on individual shards, and shards reports each shard's work; these fields describe separate parts of distributed execution. (high confidence) — [source](https://www.mongodb.com/docs/manual/core/sharded-cluster-query-router/)

## How it works

- mongos uses shard-key predicates and routing metadata to send a query to one shard or a subset of shards when it can narrow ownership. A query sent to every shard is a broadcast, also called scatter-gather. (high confidence) — [source](https://www.mongodb.com/docs/manual/core/sharded-cluster-query-router/)
- In MongoDB 8.3 explain output for a sharded collection, queryPlanner.winningPlan.shards lists the shards accessed. Compare those shard names with the cluster's complete shard list: one shard or a proper subset indicates targeted routing, while the full set indicates all-shard broadcast. In plans that show router stages, SINGLE_SHARD identifies a single-shard plan, but SHARD_MERGE alone does not prove broadcast because it can merge results from a subset or from all shards. (high confidence) (verified as of 2026-10-20) — [source](https://www.mongodb.com/docs/v8.3/reference/explain-results/)

## Problems, failure modes and limitations

- MongoDB issue SERVER-82218 records that sharded aggregation explain once used a shard-targeting code path different from actual execution and lists the fix version as 7.3.0-rc0; this is a historical caveat, not evidence that 8.3 still diverges. (low confidence) (verified as of 2023-11-17) — [source](https://jira.mongodb.org/browse/SERVER-82218)
- mongos uses shard-key values and chunk metadata to route a query to the shard or subset of shards that can contain its data. A query using a compound shard-key prefix can also be targeted; when mongos cannot narrow routing from the query, it broadcasts to all shards and merges their responses. (high confidence) — [source](https://www.mongodb.com/docs/manual/core/sharded-cluster-query-router/)

## Comparisons and alternatives

- For sharded aggregation explain, mergeType reports where the merge occurs, splitPipeline shows which pipeline work runs on shards, and shards reports per-shard work. Use the shards list to classify targeted routing versus all-shard broadcast; mergeType alone describes merge location, not fan-out count. (high confidence) (verified as of 2026-10-19) — [source](https://www.mongodb.com/docs/manual/core/sharded-cluster-query-router/)

## Facts and statements

- The presence of a shard-key predicate does not guarantee that mongos will contact only one shard: MongoDB says some such queries can still broadcast depending on data distribution and selectivity. Read the shard names in explain output to see the actual participating set. (high confidence) — [source](https://www.mongodb.com/docs/manual/core/sharded-cluster-query-router/)
