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

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Fixed
    • Priority: Major - P3
    • 4.0.1, 4.1.1
    • Affects Version/s: None
    • Component/s: Querying
    • None
    • Fully Compatible
    • v4.0
    • Query 2018-07-02, Query 2018-07-16
    • 0
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None

      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.

            Assignee:
            Nicholas Zolnierz
            Reporter:
            Nicholas Zolnierz
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: