-
Type: New Feature
-
Resolution: Unresolved
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: Querying
-
Environment:all
-
Query Optimization
Ability to use Limit() with Distinct()... or any of the cursor methods for the matter (sort, count, skip, etc. although limit has the biggest impact).
Apparently there is no simple way to currently perform the following SQL query:
SELECT DISTINCT(myField) FROM myTable WHERE x = y LIMIT(20)
The current Distinct() implementation only allows for bringing back ALL distinct values in the collection or matching a query, but there is no way to limit these results. This would be very convenient and there are many use cases.
- related to
-
SERVER-25184 Add a $distinct aggregation stage
- Backlog
-
SERVER-4507 aggregation: optimize $group to take advantage of sorted sequences
- Backlog
-
SERVER-27915 Make $group with $addToSet accumulator use DISTINCT_SCAN when applicable
- Backlog
-
SERVER-9507 Optimize $sort+$group+$first pipeline to avoid full index scan
- Closed