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

minimize disk fetches for $mod indexed query

    • Type: Icon: Improvement Improvement
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.5.5
    • Affects Version/s: 2.4.8, 2.5.4
    • Component/s: Querying
    • Labels:
    • Fully Compatible

      Observed behavior: The $mod query operator is excluded during index key matching.
      Expected behavior: If a $mod query operator does not match an index key, the match is rejected before the document is loaded.

      Test

      > c.ensureIndex( { a:1 } );
      > c.save( { a:0 } );
      > c.save( { a:1 } );
      > printjson( c.find( { a:{ $mod:[ 2, 0 ] } } ).hint( { a:1 } ).explain() )
      {
      	"cursor" : "BtreeCursor a_1",
      	"isMultiKey" : false,
      	"n" : 1,
      	"nscannedObjects" : 2,              // This is expected to be 1.
      	"nscanned" : 2,
      	"nscannedObjectsAllPlans" : 2,
      	"nscannedAllPlans" : 2,
      	"scanAndOrder" : false,
      	"indexOnly" : false,
      	"nYields" : 0,
      	"nChunkSkips" : 0,
      	"millis" : 0,
      	"indexBounds" : {
      		"a" : [
      			[
      				-1.7976931348623157e+308,
      				1.7976931348623157e+308
      			]
      		]
      	},
      	"server" : "Aaron-Staples-MacBook-Pro.local:27017"
      }
      

            Assignee:
            benety.goh@mongodb.com Benety Goh
            Reporter:
            aaron Aaron Staple
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: