Details
-
Improvement
-
Resolution: Unresolved
-
Major - P3
-
None
-
None
-
None
-
None
-
Query Optimization
Description
In a $setWindowFields stage, if one of the 'output' fields ends up not being used, we could rewrite the query to avoid computing that field:
{$setWindowFields: {
|
output: {
|
total: {$sum: "$x"},
|
avg: {$avg: "$x"},
|
}
|
}},
|
{$unset: 'avg'}
|
would optimize to:
{$setWindowFields: {
|
output: {
|
total: {$sum: "$x"},
|
}
|
}},
|
{$unset: 'avg'}
|
It might make sense to do this for unused $project fields first: SERVER-55886
Attachments
Issue Links
- depends on
-
SERVER-55886 Optimize away unused computed fields
-
- Backlog
-