[SERVER-6353] minimize disk fetches for $mod indexed query Created: 08/Jul/12  Updated: 11/Jul/16  Resolved: 09/Dec/13

Status: Closed
Project: Core Server
Component/s: Querying
Affects Version/s: 2.4.8, 2.5.4
Fix Version/s: 2.5.5

Type: Improvement Priority: Major - P3
Reporter: Aaron Staple Assignee: Benety Goh
Resolution: Done Votes: 0
Labels: query_triage
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: File server6353.js    
Issue Links:
Depends
depends on SERVER-11817 refactor IndexBoundsBuilder to use an... Closed
Related
is related to SERVER-11852 some regex queries have an unnecessar... Closed
Backwards Compatibility: Fully Compatible
Participants:

 Description   

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



 Comments   
Comment by Githook User [ 09/Dec/13 ]

Author:

{u'username': u'benety', u'name': u'Benety Goh', u'email': u'benety@mongodb.com'}

Message: SERVER-6353 tightened index bounds for $mod operator to minimize disk fetches
Branch: master
https://github.com/mongodb/mongo/commit/2a0b5f2e171db7e6fac39b94794d9c0e0b3a5ff0

Generated at Thu Feb 08 03:11:26 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.