-
Type:
Improvement
-
Resolution: Unresolved
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
DB Integration & Observability
-
None
-
None
-
None
-
None
-
None
-
None
-
None
The queryStats top-K sort optimization (SERVER-129387) sets a TopKSortSpec hint on $queryStats for {$queryStats, $sort, $limit:K} pipelines, and the exec stage materializes only the K candidates we want to return. We left the $sort and $limit stages in the pipeline for correctness reasons. When a query stats entry fails to reparse, the exec stage falls back to a full store scan so we can guarantee we will always return at least K documents.
However, this ticket should investigate approaches to remove this fall back while guaranteeing correctness, so we could remove the $sort/$limit stages, since we already perform the sort/limit inside the exec stage.
See TODO in the code for more details.
- related to
-
SERVER-129387 Optimize $queryStats for top-k metrics.workingTimeMillis.sum sort + limit pattern
-
- Closed
-