Problem with in-memory sort

XMLWordPrintableJSON

    • Type: Question
    • Resolution: Done
    • Priority: Major - P3
    • None
    • Affects Version/s: 2.6.8
    • Component/s: Querying
    • None
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None

      I have 40050 document within a collection. The document has about 48 attributes and with size being 935 (used Object.bsonsize(..) to identify the size).
      When I try to run,
      db.collection.find(

      {someSearhCriteria}

      ).sort(

      {attribute1:1}

      ).limit(50).skip(40000)
      it results in
      error:

      { "$err" : "Runner error: Overflow sort stage buffered data usage of 33555101 bytes exceeds internal limit of 33554432 bytes", "code" : 17144 }

      at src/mongo/shell/query.js:131

      I understand that creating an index on "attribute1" would fix this problem. In my application however, we enable sorting on all the 48 attributes the document has. Also, the number of documents satisfying the criteria could run into few hundred thousands. I want to understand if you still suggest creating index on all the 48 attributes? Or is there a better approach?

      Would appreciate your help.

            Assignee:
            Unassigned
            Reporter:
            Yuvi [X]
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: