[SERVER-15169] performance regression in .skip() using btree cursor Created: 08/Sep/14  Updated: 23/Sep/14  Resolved: 08/Sep/14

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

Type: Bug Priority: Major - P3
Reporter: Bruce Lucas (Inactive) Assignee: Ramon Fernandez Marina
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates SERVER-13946 Consider putting skip stages below fe... Closed
Operating System: ALL
Participants:

 Description   

Insert some documents

var f = 10
var n = 100000
 
doc = {}
for (var i=0; i<f; i++)
    doc[i] = i
 
db.c.drop()
for (var i=0; i<n; i++)
    db.c.insert(doc)

Skip over all but 1 using _id index, get the last:

db.c.find().hint({_id:1}).skip(n-1).next()

Performs about 2x worse in 2.6.4 than 2.4.10:

v 2.4.10 n 100000 f 10 t 49
v 2.6.4 n 100000 f 10 t 93

The reason seems to be that mongod is fetching the skipped documents in 2.6.x but not in 2.4.x, so the ratio could be much worse if the collection doesn't fit in memory and the skipped documents must be paged in.



 Comments   
Comment by Scott Hernandez (Inactive) [ 08/Sep/14 ]

It is the same underlying cause. We can update the other issue but don't need two for the same thing.

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