[SERVER-5374] batchSize is a hard limit for an in memory sort Created: 23/Mar/12  Updated: 12/Jun/14  Resolved: 17/Jan/13

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Question Priority: Major - P3
Reporter: Aaron Staple Assignee: Unassigned
Resolution: Duplicate Votes: 2
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Duplicate
duplicates SERVER-7694 external sort for find command Closed
is duplicated by SERVER-6015 using sort() with batchSize() never r... Closed
is duplicated by SERVER-7267 Batch size + sort closes the cursor Closed
Related
related to SERVER-14228 Setting batchSize and sort on a curso... Closed
Participants:

 Description   

Batch size is a hard limit if the selected plan for a query does an in memory sort. (The first and only batch will have size <= the specified batchSize.) This behavior isn't explicitly described in the docs, so I wanted to check if it's desired.

> c.save( {} )
> c.save( {} )
> c.save( {} )
> c.find().batchSize( 2 )
{ "_id" : ObjectId("4f6bc6c16f6654844e41b644") }
{ "_id" : ObjectId("4f6bc6c16f6654844e41b645") }
{ "_id" : ObjectId("4f6bc6c56f6654844e41b646") }
> c.find().sort( {a:1} ).batchSize( 2 )
{ "_id" : ObjectId("4f6bc6c16f6654844e41b644") }
{ "_id" : ObjectId("4f6bc6c16f6654844e41b645") }



 Comments   
Comment by Eliot Horowitz (Inactive) [ 17/Jan/13 ]

SERVER-7694

Comment by alex giamas [ 10/May/12 ]

Please take a look at Java-402 issue and this thread from mongodb-user, looks like you've hit the same issue.
http://grokbase.com/t/gg/mongodb-user/1216edq2mf/old-new-bug-batchsize-and-sort-not-working-v2-0-2

Generated at Thu Feb 08 03:08:41 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.