summaryrefslogtreecommitdiff
path: root/src/mongo/db/query/plan_ranker.cpp
diff options
context:
space:
mode:
authorDavid Storch <david.storch@10gen.com>2014-03-05 10:22:05 -0500
committerDavid Storch <david.storch@10gen.com>2014-03-07 17:08:01 -0500
commit20a22bdf907a0e2cd60b79f242a7375d84a3ab6a (patch)
treeb6544d991e0514c2eca34fa7ee37def1cc129ebf /src/mongo/db/query/plan_ranker.cpp
parent765409253203229a2c3577d1d8a3964f7a0d1554 (diff)
downloadmongo-20a22bdf907a0e2cd60b79f242a7375d84a3ab6a.tar.gz
SERVER-13038 verbose query logging cleanup
Diffstat (limited to 'src/mongo/db/query/plan_ranker.cpp')
-rw-r--r--src/mongo/db/query/plan_ranker.cpp46
1 files changed, 26 insertions, 20 deletions
diff --git a/src/mongo/db/query/plan_ranker.cpp b/src/mongo/db/query/plan_ranker.cpp
index af110dcdefc..fc2d3b9d4b3 100644
--- a/src/mongo/db/query/plan_ranker.cpp
+++ b/src/mongo/db/query/plan_ranker.cpp
@@ -89,13 +89,16 @@ namespace mongo {
// Compute score for each tree. Record the best.
for (size_t i = 0; i < statTrees.size(); ++i) {
- QLOG() << "scoring plan " << i << ":"
- << candidates[i].solution->toString() << "\n stats:\n"
+ QLOG() << "Scoring plan " << i << ":" << endl
+ << candidates[i].solution->toString() << "Stats:\n"
<< statsToBSON(*statTrees[i]).jsonString(Strict, true);
+ LOG(2) << "Scoring query plan: " << getPlanSummary(*candidates[i].solution)
+ << " planHitEOF=" << statTrees[i]->common.isEOF;
+
double score = scoreTree(statTrees[i]);
QLOG() << "score = " << score << endl;
if (statTrees[i]->common.isEOF) {
- QLOG() << "adding +" << eofBonus << " EOF bonus to score" << endl;
+ QLOG() << "Adding +" << eofBonus << " EOF bonus to score." << endl;
score += 1;
}
scoresAndCandidateindices.push_back(std::make_pair(score, i));
@@ -225,29 +228,32 @@ namespace mongo {
double tieBreakers = noFetchBonus + noSortBonus + noIxisectBonus;
double score = baseScore + productivity + tieBreakers;
- QLOG() << "score (" << score << ") = baseScore(" << baseScore << ")"
- << " + productivity((" << stats->common.advanced
- << " advanced)/("
- << stats->common.works
- << " works + "
- << stats->common.needFetch
- << " needFetch) = "
- << productivity << ")"
- << " + tieBreakers(" << noFetchBonus
- << " noFetchBonus + "
- << noSortBonus
- << " noSortBonus + "
- << noIxisectBonus
- << " noIxisectBonus = "
- << tieBreakers << ")"
- << endl;
+ mongoutils::str::stream ss;
+ ss << "score(" << score << ") = baseScore(" << baseScore << ")"
+ << " + productivity((" << stats->common.advanced
+ << " advanced)/("
+ << stats->common.works
+ << " works + "
+ << stats->common.needFetch
+ << " needFetch) = "
+ << productivity << ")"
+ << " + tieBreakers(" << noFetchBonus
+ << " noFetchBonus + "
+ << noSortBonus
+ << " noSortBonus + "
+ << noIxisectBonus
+ << " noIxisectBonus = "
+ << tieBreakers << ")";
+ std::string scoreStr = ss;
+ QLOG() << scoreStr << endl;
+ LOG(2) << scoreStr;
if (forceIntersectionPlans) {
if (hasStage(STAGE_AND_HASH, stats) || hasStage(STAGE_AND_SORTED, stats)) {
// The boost should be >2.001 to make absolutely sure the ixisect plan will win due
// to the combination of 1) productivity, 2) eof bonus, and 3) no ixisect bonus.
score += 3;
- QLOG() << "score boosted to " << score << " due to forceIntersectionPlans" << endl;
+ QLOG() << "Score boosted to " << score << " due to forceIntersectionPlans." << endl;
}
}