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

Consider checking whether the array passed to $in is already sorted before calling std::sort

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.0.1, 4.1.1
    • Component/s: Querying
    • Labels:
      None
    • Backwards Compatibility:
      Fully Compatible
    • Backport Requested:
      v4.0
    • Sprint:
      Query 2018-07-02, Query 2018-07-16
    • Linked BF Score:
      0

      Description

      As part of SERVER-35693, parsing a $in query will always sort the array argument before constructing a boost::flat_set. This greatly benefits the case where the number of elements is very large (>10k) and is unsorted, however as a side effect it hurts performance when the array is already sorted.

      One option would be to add an optimization for the sorted case by checking std::is_sorted before sorting the array.

        Attachments

          Activity

            People

            Assignee:
            nicholas.zolnierz Nicholas Zolnierz
            Reporter:
            nicholas.zolnierz Nicholas Zolnierz
            Participants:
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: