[SERVER-20155] Query for null filters before index scan Created: 27/Aug/15 Updated: 10/Sep/15 Resolved: 10/Sep/15 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Querying |
| Affects Version/s: | 3.0.2 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Matthew Spence | Assignee: | Ramon Fernandez Marina |
| Resolution: | Duplicate | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Operating System: | ALL | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Steps To Reproduce: | If I create an index:
And then perform query like so:
or
My query plan looks like this:
This performs badly, I'm assuming because of the filter on the initial fetch. If I remove that by updating all my records with { b: null }, to have { b: "null" }(note the string) and now query for the string null rather than actual null, the plan looks like this.
The filter is missing and the query now performs as expected. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Participants: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Description |
|
Querying for null values looks like it is filtering records with fetch before hitting the index, even when the null field is part of the index. This stack overflow question seems to be related: |
| Comments |
| Comment by J Rassi [ 27/Aug/15 ] |
|
This is indeed a dup of |
| Comment by Ramon Fernandez Marina [ 27/Aug/15 ] |
|
This does look expected as per jason.rassi, david.storch, can you confirm whether this is a dup of Thanks, |