Optimize away unused computed fields

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Query Optimization
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None

      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.

            Assignee:
            [DO NOT USE] Backlog - Query Optimization
            Reporter:
            David Percy (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated: