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

Improve $sample sort memory limit exceeded error message

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: None
    • Query Optimization

      The $sample stage is implemented as a random sort + limit (when N > %5 of documents in the collection, more details here). This sort is subject to the sort memory restrictions (100MB before spilling to disk). In the case that allowDiskUse is false and this limit is hit, the error message isĀ 

      PlanExecutor error during aggregation :: caused by :: Sort exceeded memory limit of 33554432 bytes, but did not opt in to external sorting. Aborting operation. Pass allowDiskUse:true to opt in. 

      This is a confusing error message to see for a $sample query as it requires in-depth knowledge of $sample's implementation. We should improve it to be clearer.

            Assignee:
            Unassigned Unassigned
            Reporter:
            ben.shteinfeld@mongodb.com Ben Shteinfeld
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: