[SERVER-55886] Optimize away unused computed fields Created: 07/Apr/21  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: David Percy Assignee: Backlog - Query Optimization
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
is depended on by SERVER-56417 Optimize away unused 'output' fields ... Backlog
Related
is related to SERVER-13703 Presence of extraneous $project cause... Backlog
Assigned Teams:
Query Optimization
Participants:

 Description   

When we compute a new field from an expression (in a $set / $addFields / $project stage), and then that field is ignored or discarded later, we could avoid computing it in the first place.  When optimizing a $set stage, we could use getDependencies() on the pipeline suffix to decide which fields are actually dead code.

We could do a similar thing for $group (and $setWindowFields).  This may have an even bigger impact, since accumulators and window functions can use a lot of space.


Generated at Thu Feb 08 05:37:44 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.