-
Type:
Improvement
-
Resolution: Unresolved
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
Query Optimization
-
None
-
None
-
None
-
None
-
None
-
None
-
None
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
- depends on
-
SERVER-55886 Optimize away unused computed fields
-
- Backlog
-