[SERVER-12262] Use full index scan as proxy for collection scan in order to make certain queries covered Created: 06/Jan/14  Updated: 11/Jul/16  Resolved: 04/Mar/14

Status: Closed
Project: Core Server
Component/s: Querying
Affects Version/s: 2.5.4
Fix Version/s: 2.6.0-rc1

Type: Improvement Priority: Minor - P4
Reporter: David Storch Assignee: David Storch
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates SERVER-12557 $exists could use index Closed
Related
related to SERVER-12869 Index null values and missing values ... Backlog
Participants:

 Description   

The old query system would prefer full index scans to collection scans in the case of covered queries. For example, with an index on field 'foo' consider the following query:

db.t.find({foo: {$exists: true}}, {_id: 0, foo: 1});

This query would be covered by the index, hence this test which asserts that explain.indexOnly is true.

The new query system does not try to construct full index scans for things like $exists and $nin, preferring a collection scan instead. This means that in the new system, a FETCH stage is required and the query is not covered. As a performance improvement, we could eliminate these fetches and make such queries covered.



 Comments   
Comment by Githook User [ 04/Mar/14 ]

Author:

{u'username': u'dstorch', u'name': u'David Storch', u'email': u'david.storch@10gen.com'}

Message: SERVER-12262 re-enable test for negation of in query
Branch: master
https://github.com/mongodb/mongo/commit/be24805004705e204a7640143f05bef408f6b210

Comment by David Storch [ 03/Mar/14 ]

$nin was already changed to be able to use an index as part of SERVER-12532. This can be resolved as soon as relevant tests are re-enabled.

Comment by Samantha Ritter (Inactive) [ 03/Mar/14 ]

SERVER-12557 solves the $exists part of this ticket, but I am hesitant to close this because it includes other types of queries like $nin.

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