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

performance regression in .skip() using btree cursor

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Duplicate
    • Affects Version/s: 2.6.0
    • Fix Version/s: None
    • Component/s: Querying
    • Labels:
      None
    • Operating System:
      ALL

      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.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                7 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: