[SERVER-18119] Covered query over compound index using the second field does not results in an index-only query Created: 20/Apr/15 Updated: 20/Apr/15 Resolved: 20/Apr/15 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Index Maintenance, Performance, Querying |
| Affects Version/s: | 2.6.8 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Daniel Breitlauch | Assignee: | Unassigned |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Operating System: | ALL | |||||||||||||||||
| Steps To Reproduce: | Have a collection with this index:
query this:
will not even use the index… so we hint the index. and limit to 10.
|
|||||||||||||||||
| Participants: |
| Description |
|
We have a non sharded collection with a compound index. But even as it has to go through more elements of the index it should only use the index. |
| Comments |
| Comment by Daniel Breitlauch [ 20/Apr/15 ] |
|
The point is with a hint it uses the index but does not make it covered. |
| Comment by Daniel Pasette (Inactive) [ 20/Apr/15 ] |
|
You must include the prefix of a compound index in your query to enable its use in a query. Check the documentation and explanation of how compound indexes work here for more info: http://docs.mongodb.org/manual/core/index-compound/#prefixes |