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

when using skip, objects still reported as being scanned.

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: Querying
    • Labels:
      None
    • ALL

      In following example, collection has 3 matching docs on condition, and is using index to match.
      If adding a skip(2), it only returns 1 document.
      You would expect nscanned=3 but nscannedObjects should be 1, not 3, since 2 docs are skipped.
      Is that just counting bug or are we actually looking at docs, which would make skip very inefficient?

      foo:PRIMARY> db.testindex.find({a:5}).skip(2).explain()
      {
      	"cursor" : "BtreeCursor a_1",
      	"nscanned" : 3,
      	"nscannedObjects" : 3,
      	"n" : 1,
      	"millis" : 0,
      	"nYields" : 0,
      	"nChunkSkips" : 0,
      	"isMultiKey" : true,
      	"indexOnly" : false,
      	"indexBounds" : {
      		"a" : [
      			[
      				5,
      				5
      			]
      		]
      	}
      }
      

            Assignee:
            david.storch@mongodb.com David Storch
            Reporter:
            antoine Antoine Girbal
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: