[SERVER-18940] Optimise sharded aggregations that are targeted to a single shard Created: 12/Jun/15 Updated: 26/Jul/18 Resolved: 02/Aug/17 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Aggregation Framework |
| Affects Version/s: | 3.1.4 |
| Fix Version/s: | 3.5.11 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Kevin Pulo | Assignee: | Bernard Gorman |
| Resolution: | Done | Votes: | 0 |
| Labels: | optimization, performance | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Backwards Compatibility: | Fully Compatible | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Operating System: | ALL | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Steps To Reproduce: |
Then observe that the following aggs are each targeted to just one shard, but still have an unnecessarily split pipeline:
and indeed, if the aggs are run without explain, $mergeCursors aggs can be observed in verbose logs on the primary shard. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Sprint: | Query 2017-07-10, Query 2017-07-31, Query 2017-08-21 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Participants: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Description |
|
The fix implemented on
This means that an aggregation may be perfectly targeted to a single shard, but will not be passed through to that shard. Case #2 is particularly problematic when _id is appended to the shard key (to guarantee granularity), but is never actually used in queries/aggs (and the rest of the shard key is usually/often enough to target just one shard). |
| Comments |
| Comment by Githook User [ 10/Aug/17 ] |
|
Author: {'email': 'bernard.gorman@gmail.com', 'name': 'Bernard Gorman'}Message: |
| Comment by Bernard Gorman [ 02/Aug/17 ] |
|
JIRA githook was down. Commit: https://github.com/mongodb/mongo/commit/27d43e300e292043fefd7634de99160157955a17 |
| Comment by Asya Kamsky [ 26/Jan/17 ] |
|
This could be alleviated if we only considered as candidates for merge the shards that have data to contribute to the merge (SERVER-27283) - if data lived on one shard only, that's the only shard that will be involved. It might not be as fast as re-writing pipeline without merge, but it's going to be faster than moving data elsewhere. |
| Comment by Charlie Swanson [ 28/Jul/16 ] |
|
Related to |