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

when using skip, objects still reported as being scanned.

    XMLWordPrintable

    Details

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

      Description

      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
      			]
      		]
      	}
      }

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: