[DOCS-14909] It is not documented whether $match after $skip can use indexes Created: 30/Oct/21 Updated: 30/Oct/23 Resolved: 03/Nov/21 |
|
| Status: | Closed |
| Project: | Documentation |
| Component/s: | manual, Server |
| Affects Version/s: | None |
| Fix Version/s: | Server_Docs_20231030 |
| Type: | Improvement | Priority: | Minor - P4 |
| Reporter: | Platon workaccount | Assignee: | Ian Fogelman |
| Resolution: | Won't Fix | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Attachments: |
|
| Participants: | |
| Days since reply: | 2 years, 14 weeks ago |
| Epic Link: | DOCSP-11702 |
| Description |
|
There is no explicit mention on the relevant documentation page of the possibility of $match to use indexes when $skip precedes $match. |
| Comments |
| Comment by Platon workaccount [ 03/Nov/21 ] |
|
Perhaps it would be good to create a separate documentation page with a giant table of winning plans for as many combinations of aggregation stages as possible. |
| Comment by Ian Fogelman [ 02/Nov/21 ] |
|
Hi platon.work@gmail.com , I reviewed this concept with one of aggregation engineers. The consensus is that this query could be achieved in a more performant way by using some filter logic such as: _id : { $gt : "" }. $skip preceding the $match operation is not considered a best practice and we will not be able to amend the documentation for this case. |
| Comment by Platon workaccount [ 01/Nov/21 ] |
|
It is necessary if there is a document with meta-information in the collection and it must not be part of the query results. Screenshot of the beginning of collection: |
| Comment by Ian Fogelman [ 01/Nov/21 ] |
|
Hi platon.work@gmail.com , Could you provide an exact example with some sample data of when using $skip before $match would be used? |