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

Optimize extractKeyFast() fallback path

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 4.4.0-rc0, 4.7.0
    • Affects Version/s: None
    • Component/s: None
    • Fully Compatible
    • ALL
    • v4.4
    • Query 2020-03-23, Query 2020-04-06
    • 0

      The SortKeyGenerator::extractKeyFast checks to see if a path in the sort key traverses any array, and if an array is found, it returns failure so that the caller can use the slower path that supports array traversal.

      Simply checking the array path, though, triggers a conversion for fields in the input Document, so that they can reside in the Document's Value cash. That conversion is expensive if there are large documents or arrays along the path, and all that work gets thrown away if an array is encountered anywhere along the path: the "slow" path operates on the underlying BSON and gets no benefit from the cached Values.

      We could speed up some queries if we had a way to perform the check in extractKeyFastPath() without doing any BSON -> Value conversions.

            Assignee:
            ian.boros@mongodb.com Ian Boros
            Reporter:
            justin.seyster@mongodb.com Justin Seyster
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: