Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-41383

$merge should resolve 'let' variables only if they're referenced in the update pipeline

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Major - P3 Major - P3
    • None
    • 4.2.0
    • Aggregation Framework
    • None
    • Query Optimization

    Description

      Currently, if a $merge stage has the 'let' variables defined, but they're not referenced in the update pipeline, we will still resolve those variables and will pass it down to the update system, even though they're not needed. We also have a default variable `$$new` which is resolved to the entire input document if the user omitted the `let` argument. To maximize performance and reduce the stress on update throughput, we should perform an introspection of the update pipeline when creating a $merge stage and remove all `let' variables which are not used in the update pipeline.

      We can also prevent shipping out runtime constants (such as $$NOW and $$CLUSTER_TIME) with every update request if they're also not used in the update pipeline or `let` variables.

      Attachments

        Activity

          People

            backlog-query-optimization Backlog - Query Optimization
            anton.korshunov@mongodb.com Anton Korshunov
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated: