[DOCS-489] Aggregation Framework: Make Indexing Requirements More Explicit Created: 05/Sep/12  Updated: 30/Oct/23  Resolved: 13/Sep/12

Status: Closed
Project: Documentation
Component/s: manual
Affects Version/s: mongodb-2.2
Fix Version/s: Server_Docs_20231030

Type: Improvement Priority: Major - P3
Reporter: Adam Comerford Assignee: Kay Kim (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Participants:
Days since reply: 11 years, 22 weeks, 6 days ago

 Description   

This stems from a Dev chat discussion (I will paste relevant pieces in the issue) about the somewhat vague assertions regarding the use of indexes in the aggregation framework. Rather than references to "early stages" etc. it would be best to be more explicit and clearly state when indexes can and cannot be used.



 Comments   
Comment by auto [ 13/Sep/12 ]

Author:

{u'date': u'2012-09-13T15:13:42-07:00', u'email': u'samk@10gen.com', u'name': u'Sam Kleinman'}

Message: merge: DOCS-489
Branch: master
https://github.com/mongodb/docs/commit/2474334aae120beb2913ad7104e58369fb3e012e

Comment by auto [ 13/Sep/12 ]

Author:

{u'date': u'2012-09-13T14:34:17-07:00', u'email': u'kay.kim@10gen.com', u'name': u'kay'}

Message: DOCS-489 aggregation operators and indexes
Branch: master
https://github.com/mongodb/docs/commit/89a51a63d9e34bee950ef5a2c23114de6148da03

Comment by auto [ 13/Sep/12 ]

Author:

{u'date': u'2012-09-13T14:41:10-07:00', u'email': u'samk@10gen.com', u'name': u'Sam Kleinman'}

Message: minor: DOCS-489 correction
Branch: master
https://github.com/mongodb/docs/commit/90aa10fb684d48138891e2a76b9b783092d14bb1

Comment by auto [ 13/Sep/12 ]

Author:

{u'date': u'2012-09-13T14:31:23-07:00', u'email': u'samk@10gen.com', u'name': u'Sam Kleinman'}

Message: merge: DOCS-489
Branch: master
https://github.com/mongodb/docs/commit/07c629b76b2443a608d63e16dd73753dc82ca7a7

Comment by auto [ 13/Sep/12 ]

Author:

{u'date': u'2012-09-13T13:23:20-07:00', u'email': u'kay.kim@10gen.com', u'name': u'kay'}

Message: DOCS-489 aggregation operators and indexes
Branch: master
https://github.com/mongodb/docs/commit/197b16be1d9c40ba7617e83a20c0d0acc6887405

Comment by auto [ 13/Sep/12 ]

Author:

{u'date': u'2012-09-13T12:57:44-07:00', u'email': u'kay.kim@10gen.com', u'name': u'kay'}

Message: DOCS-489 aggregation operators and indexes
Branch: master
https://github.com/mongodb/docs/commit/8a41773d7d909aae3e897c9e04d9832618e02d69

Comment by Adam Comerford [ 05/Sep/12 ]

Specific pieces to improve:

http://docs.mongodb.org/manual/applications/aggregation/#early-filtering

When placed early in a pipeline, these $match operations use suitable indexes to scan only the matching documents in a collection.

This should be more explicit. For example:

Any early use of the $project operator will make subsequent use of indexes impossible. However, $match, $limit, $sort, $skip (there might be others?) can be used at the start of the pipeline and essentially will be logically combined to make use of an appropriate index

Another spot which could use clarification is the warning at the end of this page:

http://docs.mongodb.org/manual/reference/aggregation/sort/#_S_sort

Warning Unless the $sort operator can use an index, in the current release, the sort must fit within memory. This may cause problems when sorting large numbers of documents.

We need to be sure people understand that a $sort after any $project or $unwind will have to be in memory, and that $sort must be at the start (or close to the start of the pipeline as described above).

These are the two examples I am most familiar with, but there may be more.

Generated at Thu Feb 08 07:38:47 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.