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

Investigate optimizing repetitive sorts from $densify and $fill

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 5.3.0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Fully Compatible
    • QO 2021-12-13, QO 2021-12-27, QO 2022-01-10

      Points to consider:

      • Densify does not guarantee any sort order after the stage as of now. Doing this work would lock densify behavior
        • This may cause issues when we want to implement categorical densification
      • Densify sorts on {p1: 1, p2: 1, ..., densifyField: 1} in the non "full" case
      • Densify sorts on {densifyField: 1} in the "full" case
      • setWindowFields ($fill) sorts on {p1: 1, p2: 1, ..., sortBy: 1}
        • Densify does not allow "complex" (non-field path expression) partitions

      Therefore we can possibly combine the sorts in the following situations. Note that in all cases if the generated sorts on not the same, they will not be able to be combined.

      • Partitions in $densify and $fill must be the same
      • If there are partitions:
        • Densify type must not be "full"
        • $fill sortBy must be the densifyField
          • If there is a user specified sort before the non-desuguared $densify, we can still optimize if the user sortKey maintains the required sort for $densify and matches the sortBy field.
      • If there are no partitions:
        • $fill sortBy must be the densifyField
          • If there is a user specified sort before the non-desuguared $densify, we can still optimize if the user sortKey maintains the required sort for $densify and matches the sortBy field.

            Assignee:
            ted.tuckman@mongodb.com Ted Tuckman
            Reporter:
            ted.tuckman@mongodb.com Ted Tuckman
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: