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

performance regression in .skip() using btree cursor

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.6.0
    • Component/s: Querying
    • None
    • ALL

      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.

            Assignee:
            ramon.fernandez@mongodb.com Ramon Fernandez Marina
            Reporter:
            bruce.lucas@mongodb.com Bruce Lucas (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: