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

Avoid sorting $in list when it gets converted to KeyString

    XMLWordPrintableJSON

Details

    • Icon: Task Task
    • Resolution: Unresolved
    • Icon: Major - P3 Major - P3
    • None
    • None
    • None
    • Query Optimization
    • QO 2024-02-05, QO 2024-02-19

    Description

      Often we will sort the BSON elements of a $in list early in query processing. Sorting BSON elements is usually fairly slow, and for short running query, this takes a significant amount of the runtime.

       

      Sometimes, this $in list gets converted to KeyStrings, which are used for index bounds. KeyStrings are very easy/fast to compare, so we should try to delay the sorting of the $in list elements until after the KeyStrings are generated.

       

      This will not be possible in all cases, but should be a minor perf win for $in queries that get answered with ixscan/fetch plans. For example, a query that fetches a bunch of documents via a $in on _id.

      Attachments

        Activity

          People

            militsa.sotirova@mongodb.com Militsa Sotirova
            ian.boros@mongodb.com Ian Boros
            Votes:
            1 Vote for this issue
            Watchers:
            9 Start watching this issue

            Dates

              Created:
              Updated: