[SERVER-24786] Compound multikey index does not compound indexbounds when nested in an object Created: 24/Jun/16 Updated: 14/Jul/16 Resolved: 29/Jun/16 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Index Maintenance |
| Affects Version/s: | 2.6.10, 2.6.11 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Werner Smit | Assignee: | Kelsey Schubert |
| 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: | #Unbound predicate scenario
|
||||||||||||||||
| Participants: | |||||||||||||||||
| Description |
|
When creating a compound multikey index on a string- and an array field (both nested inside the same object) the indexbounds is constrained to only the leading field in the index. This behavior doesn't occur when the string and array fields are at the root level. During a query on both fields, both predicates are compounded in the index bound. Eg:
We add a compound index on `nest.a` an `nest.b`
However, if we assume the same structure but move it out of the object both predicates are bound.
Is this expected behavior? I couldn't find anything in the docs that points to limitations of nested compound multikey indexes. |
| Comments |
| Comment by Ramon Fernandez Marina [ 29/Jun/16 ] | ||
|
wernerj101, to add to Thomas' answer, please note that you can download the 3.3.9 development release today, which contains support for path-level multikey tracking, and test if the index bounds work as you would expect. Regards, | ||
| Comment by Kelsey Schubert [ 29/Jun/16 ] | ||
|
Hi wernerj101, Thanks for the report. This is expected behavior, but will be improved in MongoDB 3.4. In case when fields in the compound multikey index share a path prefix, as in
is problematic because predicates over these fields may refer to subdocuments within the same array field. As Dave describes in In our upcoming major release, MongoDB 3.4, this issue will be resolved by
also existed in the collection. But, we now have path-level multikey tracking and have used it to have tighter index bounds in our development branch. Please see Thank you, |