IndexOnly=false for covered Query through MongoS

17 views
Skip to first unread message

Patrick White

unread,
Jan 22, 2015, 3:03:19 PM1/22/15
to mongod...@googlegroups.com
I feel like questions about indexOnly have been beaten to death on these forums / the internet, but after searching I wasn't able to find any info.  See this question on SO from July (I'm not the original asker, but there hasn't been an answer):


In my case, a query that's very quick, and index only locally, is not so through MongoS. Maybe this is a limitation of MongoS I'm not aware of, or just a bug in the explain and I'm missing something?

Note: I redacted some info (server names, ids, etc), if I mis-named something, my bad, but the queries both run, etc.

The shard key for the below queries is {userId, event}

Thanks!

Here's the query:
db.entities.find({userId: "blahblah"}, {userId: 1, _id: 0}).explain()

Here's the explain directly against mongo:
{
"cursor" : "BtreeCursor userId_1_event_1",
"isMultiKey" : false,
"n" : 147132,
"nscannedObjects" : 0,
"nscanned" : 147132,
"nscannedObjectsAllPlans" : 0,
"nscannedAllPlans" : 147233,
"scanAndOrder" : false,
"indexOnly" : true,
"nYields" : 1156,
"nChunkSkips" : 0,
"millis" : 2129,
"indexBounds" : {
"userId" : [
[
"blahblah",
"blahblah"
]
],
"event" : [
[
{
"$minElement" : 1
},
{
"$maxElement" : 1
}
]
]
},
"server" : "server_2:36000",
"filterSet" : false
}

Here's the explain through mongos:

mongos> 
{
"clusteredType" : "ParallelSort",
"shards" : {
"shard_0/server_1:36000,server_2:36000,server_3:36000" : [
{
"cursor" : "BtreeCursor userId_1_event_1",
"isMultiKey" : false,
"n" : 147132,
"nscannedObjects" : 147132,
"nscanned" : 147132,
"nscannedObjectsAllPlans" : 147233,
"nscannedAllPlans" : 147233,
"scanAndOrder" : false,
"indexOnly" : false,
"nYields" : 12170,
"nChunkSkips" : 0,
"millis" : 372554,
"indexBounds" : {
"userId" : [
[
"blahblah",
"blahblah"
]
],
"event" : [
[
{
"$minElement" : 1
},
{
"$maxElement" : 1
}
]
]
},
"server" : "server_2:36000",
"filterSet" : false
}
]
},
"cursor" : "BtreeCursor userId_1_event_1",
"n" : 147132,
"nChunkSkips" : 0,
"nYields" : 12170,
"nscanned" : 147132,
"nscannedAllPlans" : 147233,
"nscannedObjects" : 147132,
"nscannedObjectsAllPlans" : 147233,
"millisShardTotal" : 372554,
"millisShardAvg" : 372554,
"numQueries" : 1,
"numShards" : 1,
"indexBounds" : {
"connectionId" : [
[
"blahblah",
"blahblah"
]
],
"event" : [
[
{
"$minElement" : 1
},
{
"$maxElement" : 1
}
]
]
},
"millis" : 372556
}

Asya Kamsky

unread,
Jan 22, 2015, 5:51:17 PM1/22/15
to mongodb-user
Hi Patrick:

I believe you are observing a bug, in particular https://jira.mongodb.org/browse/SERVER-5022 which was fixed during 2.7.x development cycle.   

If you have access to 2.8.0-rcX test cluster you could confirm whether you no longer see this behavior.

Asya


--
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.
 
For other MongoDB technical support options, see: http://www.mongodb.org/about/support/.
---
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user...@googlegroups.com.
To post to this group, send email to mongod...@googlegroups.com.
Visit this group at http://groups.google.com/group/mongodb-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/d494c10a-f60e-4063-ae34-464c89fdbe23%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages