[SERVER-5505] $size queries should use index if possible Created: 04/Apr/12 Updated: 06/Dec/22 Resolved: 22/Feb/18 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Index Maintenance, Querying, Usability |
| Affects Version/s: | 2.0.4 |
| Fix Version/s: | None |
| Type: | New Feature | Priority: | Major - P3 |
| Reporter: | Aristarkh Zagorodnikov | Assignee: | Backlog - Query Team (Inactive) |
| Resolution: | Done | Votes: | 0 |
| Labels: | array, indexing, query | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Assigned Teams: |
Query
|
| Participants: |
| Description |
|
I believe that $size queries should use index if it exists for the column. At the very least, the $size:0 should be easy to implement, because currently one has to resort to comparing to an empty array. |
| Comments |
| Comment by Asya Kamsky [ 22/Feb/18 ] |
|
Since the ticket was filed the docs now mention: "Queries cannot use indexes for the $size portion of a query, although the other portions of a query can use indexes if applicable." |
| Comment by Aristarkh Zagorodnikov [ 05/Apr/12 ] |
|
Ah, well, then I think docs should mention that $size queries are not indexed and that one can approximate $size:0 query with empty array comparison (maybe it's there, but I couldn't find it). |
| Comment by Eliot Horowitz (Inactive) [ 05/Apr/12 ] |
|
The general case of this can't use an index as we store entries, not size. |