-
Type:
Task
-
Resolution: Won't Do
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: Query Execution
-
None
-
Query Execution
-
QE 2026-08-03
-
None
-
None
-
None
-
None
-
None
-
None
-
None
This change adds an SBE optimization in the collection-scan stage builder: a scan only materializes the full document (the "result object" / recordSlot) when a downstream consumer needs it (`reqs.hasResult()`) or the scan's own filter needs the whole document. Otherwise it produces only the referenced top-level fields plus the record id.
Key changes:
- `SbBuilder::makeScan()` gained an `includeResultSlot` flag and now returns a `boost::optional<SbSlot>` result slot.
- `generateGenericCollScan()` / `generateClusteredCollScan()` compute `includeResultSlot` and skip materialization when possible (generic path extracts the filter's top-level fields; clustered path keeps the result object whenever there's a filter).
- `buildCollScan()` passes `reqs.hasResult()` down.