[SERVER-12628] Explain should indicate whether index filters were applied Created: 05/Feb/14  Updated: 14/Mar/14  Resolved: 14/Feb/14

Status: Closed
Project: Core Server
Component/s: Querying
Affects Version/s: 2.5.5
Fix Version/s: 2.6.0-rc0

Type: Improvement Priority: Major - P3
Reporter: J Rassi Assignee: Benety Goh
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to DOCS-2878 explain output for filterSet Closed
related to DOCS-2915 add field to explain output Closed
Backwards Compatibility: Fully Compatible
Participants:

 Description   

It is confusing that explain() does not indicate whether an index filter was applied. Including this information can significantly help the slow-query debugging process.

> db.foo.insert({_id:0, a:1})
SingleWriteResult({
	"writeErrors" : [ ],
	"writeConcernErrors" : [ ],
	"nInserted" : 1,
	"nUpserted" : 0,
	"nUpdated" : 0,
	"nModified" : 0,
	"nRemoved" : 0,
	"upserted" : [ ]
})
> db.foo.runCommand("planCacheSetFilter",{query:{a:1},indexes:[{_id:1}]})
{ "ok" : 1 }
> db.foo.find({a:1}).hint({a:1}).explain()
{
	"cursor" : "BasicCursor", // no indication as to why hinted index is not being used
	"n" : 1,
	"nscannedObjects" : 1,
	"nscanned" : 1,
	"nscannedObjectsAllPlans" : 1,
	"nscannedAllPlans" : 1,
	"scanAndOrder" : false,
	"indexOnly" : false,
	"nYields" : 0,
	"nChunkSkips" : 0,
	"millis" : 0,
	"server" : "Rassi-MacBook-Pro.local:27017"
}
>



 Comments   
Comment by Githook User [ 14/Feb/14 ]

Author:

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

Message: SERVER-12628 added filterSet field to explain to indicate if index filter is applied.
Branch: master
https://github.com/mongodb/mongo/commit/69e320cf6fde7a7cfd544d7f7b5aadd06f7560e4

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