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

Implement missing optimizations for $set* expressions

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 5.3.0
    • Affects Version/s: None
    • Component/s: None
    • Fully Compatible
    • QE 2021-08-09

      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.

            Assignee:
            rui.liu@mongodb.com Rui Liu
            Reporter:
            arun.banala@mongodb.com Arun Banala
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: