[SERVER-22690] Short circuit mongos queries Created: 17/Feb/16 Updated: 06/Dec/22 |
|
| Status: | Backlog |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Jason Zucchetto | Assignee: | Backlog - Query Optimization |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Assigned Teams: |
Query Optimization
|
| Participants: |
| Description |
|
For certain scenarios, such as finding a single document (without a sort) from mongos, mongos should immediately return results that are found (and before all shards respond). E.g.
Short circuiting from mongos should only occur when a limit is placed on the query, and with no sort. |
| Comments |
| Comment by David Storch [ 17/Feb/16 ] |
|
At least in 3.2, mongos will always wait for responses from every targeted shard before returning the first batch to the user. We do this in order to ensure that we have successfully established the shard version on every node. (It isn't always correct to start returning results to the client until the shard version is fully established.) This optimization requires that we have knowledge of when it is safe to start returning results before hearing from other nodes. I think we can do this as long as there isn't a sort? |
| Comment by Spencer Brody (Inactive) [ 17/Feb/16 ] |
|
My impression was that we already did this, though I have not confirmed. jason.zucchetto, what makes you think this isn't the existing behavior? |