[SERVER-42647] Compound partialFilterExpression not being used - despite correct index chosen Created: 06/Aug/19 Updated: 09/Aug/19 Resolved: 09/Aug/19 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Index Maintenance, Querying |
| Affects Version/s: | 4.0.10, 4.2.0-rc6 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Eliott Coyac | Assignee: | Danny Hatcher (Inactive) |
| Resolution: | Duplicate | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Attachments: |
|
||||||||
| Issue Links: |
|
||||||||
| Operating System: | ALL | ||||||||
| Steps To Reproduce: | Restore the attached collection 'data.companies-test' (a much lighter version of my dataset). In a shell, run the following commands:
Wait for the index to be finished, then run the command:
Witness that there is a filter step in the execution stages, on both financial.gross and state. |
||||||||
| Participants: | |||||||||
| Description |
|
I have this index on my collection:
Then I want to count the documents in the index:
It does use the index created, but there is still a filter stage where both financial.gross and state are tested, as seen in the execution stats (attached). It shouldn't filter at all, since those conditions are the exact same as the partialFilterExpression. Ironically, doing something like:
is faster since then it only filters on state. |
| Comments |
| Comment by Eliott Coyac [ 09/Aug/19 ] |
|
This seems to be a duplicate indeed. Thank you. |
| Comment by Danny Hatcher (Inactive) [ 09/Aug/19 ] |
|
Thanks for your report. You are correct that there is still a FETCH stage. We have |