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

    • Improvement
    • Status: Closed
    • Major - P3
    • Resolution: Fixed
    • None
    • 4.0.1, 4.1.1
    • Querying
    • None
    • Fully Compatible
    • v4.0
    • Query 2018-07-02, Query 2018-07-16
    • 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

            nicholas.zolnierz@mongodb.com Nicholas Zolnierz
            nicholas.zolnierz@mongodb.com Nicholas Zolnierz
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: