-
Type: Task
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: None
-
None
-
Fully Compatible
-
69
In the row store fallback path of column index plans, we apply a projection to the row store document to ensure that it has the same "schema" as the documents that would have been returned by the column index path. This is fairly expensive, and can often be skipped (including any time there is a $group above the column scan).
This would build off of the analysis done in SERVER-66061 where we detect cases where a projection is not necessary. In the same cases (unless I'm forgetting an edge case), we should be able to skip adding this expression which projects the full document retrieved from the row store. That is added [here](https://github.com/10gen/mongo/blob/21b7dfd8f85224445da4f6098f22ac463ee18f72/src/mongo/db/query/sbe_stage_builder.cpp#L764) unconditionally. We should be able to attach some boolean to the ColumnIndexScanNode which can say whether or not a projection is necessary. That same ColumnIndexScanNode should be available and in scope in [this analysis from SERVER-66061](https://github.com/10gen/mongo/blob/21b7dfd8f85224445da4f6098f22ac463ee18f72/src/mongo/db/query/planner_analysis.cpp#L424). There we could add a boolean flag to say "I don't need an exact schema", in case there is a subsequent $group stage. ian.boros@mongodb.com suggested calling this "isStrict" or something like that.
We should be able to test this code path by inspecting the SBE plan in the explain output, where we should be able to tell if there is a row store expression or not.
- is depended on by
-
SERVER-69105 Achieve column index performance acceptable for release
- Closed