[SERVER-5775] index-only query apparently not executed as index-only Created: 07/May/12  Updated: 15/Aug/12  Resolved: 07/May/12

Status: Closed
Project: Core Server
Component/s: Querying
Affects Version/s: 2.0.4
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Chris Westin Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Window 7, single node


Issue Links:
Duplicate
duplicates SERVER-2104 covered index should support dotted f... Closed
Operating System: ALL
Participants:

 Description   

I was working through the exercises in the training course in the indexing section. As a variation from the instructions, one of the students tried to explain() what should have been an index-only query, but it was not reported as such by explain. To recreate, load the twitter.tweets collection from the training sample data set. Then:

> db.tweets.find({'user.friends_count:{$gt:100},
                  'user.followers_count':{$gt:100}},
     {'user.friends_count':1, _id:0}).explain();
 
{
        "cursor" : "BtreeCursor user.friends_count_1_user.followers_count_1",
        "nscanned" : 26377,
        "nscannedObjects" : 25984,
        "n" : 25984,
        "millis" : 458,
        "nYields" : 0,
        "nChunkSkips" : 0,
        "isMultiKey" : false,
        "indexOnly" : false,
        "indexBounds" : {
                "user.friends_count" : [
                        [
                                100,
                                1.7976931348623157e+308
                        ]
                ],
                "user.followers_count" : [
                        [
                                100,
                                1.7976931348623157e+308
                        ]
                ]
        }
}
>

Note the indexOnly field in the explain() result is false, even though the selection list only includes the first field of the index key.



 Comments   
Comment by Aaron Staple [ 07/May/12 ]

I think this is SERVER-2104.

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