[SERVER-20536] Combining $comment and .count() degrades performance Created: 21/Sep/15 Updated: 28/Nov/16 Resolved: 05/Feb/16 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Querying |
| Affects Version/s: | None |
| Fix Version/s: | 3.3.2 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Alon Horev | Assignee: | Charlie Swanson |
| Resolution: | Done | Votes: | 0 |
| Labels: | neweng | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||
| Backwards Compatibility: | Major Change | ||||||||||||||||
| Operating System: | ALL | ||||||||||||||||
| Sprint: | Query 10 (02/22/16) | ||||||||||||||||
| Participants: | |||||||||||||||||
| Description |
|
When passing a $comment in a query count() doesn't use an index. Testcase:
|
| Comments |
| Comment by Charlie Swanson [ 05/Feb/16 ] | |||||||||||||
|
This is a potentially backwards breaking change. If you specify a hint to use a sparse index with an empty count predicate, it used to ignore the hint. It will now respect the hint, potentially giving you the wrong count. We may want to add this to the compatibility notes? For example:
| |||||||||||||
| Comment by Githook User [ 05/Feb/16 ] | |||||||||||||
|
Author: {u'username': u'cswanson310', u'name': u'Charlie Swanson', u'email': u'charlie.swanson@mongodb.com'}Message: | |||||||||||||
| Comment by J Rassi [ 21/Sep/15 ] | |||||||||||||
|
Thanks for the report, Alon. It looks like we currently fail to apply the Collection::numRecords() optimization for the count command if the query object is non-empty. Setting fixVersion to "Needs Triage"; we'll take a deeper look at this at our next triage meeting. |