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

Optimized code path for "simple" sort operations in PlanStage layer

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Major - P3 Major - P3
    • 4.3.4
    • None
    • Querying
    • None
    • Fully Compatible
    • Query 2020-02-10, Query 2020-02-24
    • 0

    Description

      The current implementation of SortStage is fully general in the sense that it can handle sorting all of the data that can be associated with a WorkingSetMember. This includes:

      • Sorting WorkingSetMembers that represent index keys.
      • Carrying RecordIds alongside the documents being sorted. This is necessary to support findAndModify with a sort. The RecordId is subsequently used by findAndModify to identify the document to update or delete.
      • Carrying metadata alongside the documents being sorted. This could be textScore metadata, geoNear distance metadata, or sortKey metadata, for example.

      This all comes with a cost. We can avoid sorting this unnecessary data in many cases, e.g. for sort operations other than findAndModify which don't involve metadata, and where the data has been fetched. This is done by introducing a new variant of SortStage which sorts simple BSON objects instead of entire WorkingSetMembers. An early prototype of this approach shows significant performance gains on several sort-related benchmarks.

      Attachments

        Activity

          People

            david.storch@mongodb.com David Storch
            david.storch@mongodb.com David Storch
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: