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

Optimize $sample+$project

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor - P4
    • Resolution: Duplicate
    • None
    • None
    • Aggregation Framework
    • None
    • Query

    Description

      When performing a pipeline doing a sample then project I noticed it was much slower than doing a project then sample. Could this be optimized? In a similar fashion as to: https://docs.mongodb.com/manual/core/aggregation-pipeline-optimization

      For example with the MovieLens dataset ~1million documents:

      Pipeline: $sample + $project _id: 76120 ms
      Pipeline: $project _id + $sample: 1124 ms

      Attachments

        Issue Links

          Activity

            People

              backlog-server-query Backlog - Query Team (Inactive)
              ross@mongodb.com Ross Lawley
              Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: