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

Implement missing optimizations for $set* expressions

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Blocked
    • Priority: Major - P3
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: Backlog
    • Component/s: None
    • Labels:
      None
    • Sprint:
      QE 2021-08-23, QE 2021-10-18, QE 2021-11-01, QE 2021-11-15, QE 2021-11-29, QE 2021-12-13

      Description

      We have observed two performance improvements for set related expression:

      1. Use unordered sets instead of ordered sets
      2. Cache constant sets to avoid the set building

      These two optimizations have been implemented for $setIsSubset expression, but not for other expressions.

      One problem for porting these optimization to other set expression is using unordered sets causes the set element order being non deterministic. These can fail the fuzzer tests also may result in cascading non-deterministic expression values. (e.g. $group on $setIntersection). Note that this is not a problem for $setIsSubset expression since it's of boolean value. See related tickets https://jira.mongodb.org/browse/SERVER-58875 and https://jira.mongodb.org/browse/TIG-3254 for some context.

      We have the following potential proposals:

      1. Sort the set expression values before return to ensure a consistent order
      2. Let the expression be non-deterministic, fix the fuzzer by either not generating set expressions or by other more complicated mechanisms.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              rui.liu Rui Liu
              Reporter:
              rui.liu Rui Liu
              Participants:
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated: