summaryrefslogtreecommitdiff
path: root/src/mongo/db/query/query_planner.cpp
diff options
context:
space:
mode:
authorAnton Korshunov <anton.korshunov@mongodb.com>2019-10-31 15:46:48 +0000
committerevergreen <evergreen@mongodb.com>2019-10-31 15:46:48 +0000
commitbc26f68ff09269816cb0118ad8f2a25ee17ad0e9 (patch)
tree385965c17de3da445222b300ee8ecb9c70437add /src/mongo/db/query/query_planner.cpp
parentfd7aaa92a2e3309980689e99125eead70e7c0317 (diff)
downloadmongo-bc26f68ff09269816cb0118ad8f2a25ee17ad0e9.tar.gz
SERVER-42905 Push down user-specified projections to PlanStage layer if possible
Diffstat (limited to 'src/mongo/db/query/query_planner.cpp')
-rw-r--r--src/mongo/db/query/query_planner.cpp11
1 files changed, 2 insertions, 9 deletions
diff --git a/src/mongo/db/query/query_planner.cpp b/src/mongo/db/query/query_planner.cpp
index 46d90750b5c..682e27de35b 100644
--- a/src/mongo/db/query/query_planner.cpp
+++ b/src/mongo/db/query/query_planner.cpp
@@ -117,9 +117,6 @@ string optionString(size_t options) {
case QueryPlannerParams::SPLIT_LIMITED_SORT:
ss << "SPLIT_LIMITED_SORT ";
break;
- case QueryPlannerParams::NO_UNCOVERED_PROJECTIONS:
- ss << "NO_UNCOVERED_PROJECTIONS ";
- break;
case QueryPlannerParams::GENERATE_COVERED_IXSCANS:
ss << "GENERATE_COVERED_IXSCANS ";
break;
@@ -849,9 +846,7 @@ StatusWith<std::vector<std::unique_ptr<QuerySolution>>> QueryPlanner::plan(
// $** index is hinted, we do not want this behavior.
if (!hintedIndex.isEmpty() && relevantIndices.size() == 1) {
if (0 == out.size() && relevantIndices.front().type != IndexType::INDEX_WILDCARD) {
- // Push hinted index solution to output list if found. It is possible to end up without
- // a solution in the case where a filtering QueryPlannerParams argument, such as
- // NO_UNCOVERED_PROJECTIONS, leads to its exclusion.
+ // Push hinted index solution to output list if found.
auto soln = buildWholeIXSoln(relevantIndices.front(), query, params);
if (soln) {
LOG(5) << "Planner: outputting soln that uses hinted index as scan.";
@@ -966,10 +961,8 @@ StatusWith<std::vector<std::unique_ptr<QuerySolution>>> QueryPlanner::plan(
}
QueryPlannerParams paramsForCoveredIxScan;
- paramsForCoveredIxScan.options =
- params.options | QueryPlannerParams::NO_UNCOVERED_PROJECTIONS;
auto soln = buildWholeIXSoln(index, query, paramsForCoveredIxScan);
- if (soln) {
+ if (soln && !soln->root->fetched()) {
LOG(5) << "Planner: outputting soln that uses index to provide projection.";
PlanCacheIndexTree* indexTree = new PlanCacheIndexTree();
indexTree->setIndexEntry(index);