[SERVER-5361] early $group should provide a hint to use an index matching the group key Created: 22/Mar/12 Updated: 15/Aug/12 Resolved: 30/Mar/12 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Aggregation Framework |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Chris Westin | Assignee: | Chris Westin |
| Resolution: | Duplicate | Votes: | 1 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||
| Participants: | |||||||||||||||||
| Description |
|
For an example query that could use this (assuming the appropriate index is there), see https://groups.google.com/forum/#!msg/mongodb-user/V5nO8gkgzbk/iI9F_faNPFsJ . |
| Comments |
| Comment by Chris Westin [ 29/Mar/12 ] |
|
@Samual Garcia Martinez: values of query_hash can repeat for different date values, so there's no way to use a concatenated key index for this. The best that could be done would be to use an index on date to do the initial filtering. 2.1.1 already has that optimization. |
| Comment by Samuel García Martínez [ 29/Mar/12 ] |
|
This makes a lot of sense. Even should use compound indexes, in order to use same index as previous $match clause. Querying like }}, ,totalCount:{$sum:"$queryCount"}} }, I think it would be nice to be able to use a compound index instead of using two separated indexes. |