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

incorrect nscannedObjects for explain for index intersection

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

      There is an index on city and on state:

      geo@local(2.5.5) > db.zips.find({city:"HAZARD"}).explain()
      {
      	"cursor" : "BtreeCursor city_1",
      	"isMultiKey" : false,
      	"n" : 2,
      	"nscannedObjects" : 2,
      	"nscanned" : 2,
      	"nscannedObjectsAllPlans" : 2,
      	"nscannedAllPlans" : 2,
      	"scanAndOrder" : false,
      	"indexOnly" : false,
      	"nYields" : 0,
      	"nChunkSkips" : 0,
      	"millis" : 0,
      	"indexBounds" : {
      		"city" : [
      			[
      				"HAZARD",
      				"HAZARD"
      			]
      		]
      	},
      	"server" : "asyasmacbook.local:27017"
      }
      geo@local(2.5.5) > db.zips.find({state:"CA"}).explain()
      {
      	"cursor" : "BtreeCursor state_1",
      	"isMultiKey" : false,
      	"n" : 1523,
      	"nscannedObjects" : 1523,
      	"nscanned" : 1523,
      	"nscannedObjectsAllPlans" : 1523,
      	"nscannedAllPlans" : 1523,
      	"scanAndOrder" : false,
      	"indexOnly" : false,
      	"nYields" : 11,
      	"nChunkSkips" : 0,
      	"millis" : 3,
      	"indexBounds" : {
      		"state" : [
      			[
      				"CA",
      				"CA"
      			]
      		]
      	},
      	"server" : "asyasmacbook.local:27017"
      }
      geo@local(2.5.5) > db.zips.find({city:"HAZARD",state:"CA"}).explain()
      {
      	"cursor" : "Complex Plan",
      	"n" : 1,
      	"nscannedObjects" : 0,
      	"nscanned" : 1525,
      	"nscannedObjectsAllPlans" : 0,
      	"nscannedAllPlans" : 1525,
      	"nYields" : 11,
      	"nChunkSkips" : 0,
      	"millis" : 1,
      	"server" : "asyasmacbook.local:27017"
      }
      geo@local(2.5.5) >
      

            Assignee:
            david.storch@mongodb.com David Storch
            Reporter:
            asya.kamsky@mongodb.com Asya Kamsky
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: