summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Storch <david.storch@10gen.com>2015-04-07 11:01:38 -0400
committerDavid Storch <david.storch@10gen.com>2015-04-10 09:33:11 -0400
commitcc61da0890124c5fd5943b38d051b1bd4a96b961 (patch)
treea6ba163cb984d99f563b87faf8681e7e2d127aff
parent6f1f5bbc9fe884b0367752dc661fd88063ecb225 (diff)
downloadmongo-cc61da0890124c5fd5943b38d051b1bd4a96b961.tar.gz
SERVER-17815 ensure plan ranking tie breaker does not cause an inferior plan to win
(cherry picked from commit 122ceeaf9caca8ac1a93e1bed1a7286315aee0ab)
-rw-r--r--src/mongo/db/query/plan_ranker.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/mongo/db/query/plan_ranker.cpp b/src/mongo/db/query/plan_ranker.cpp
index 01dc6d3cd90..cf89cd170fd 100644
--- a/src/mongo/db/query/plan_ranker.cpp
+++ b/src/mongo/db/query/plan_ranker.cpp
@@ -200,9 +200,9 @@ namespace mongo {
double productivity = static_cast<double>(stats->common.advanced)
/ static_cast<double>(workUnits);
- // Just enough to break a tie.
- static const double epsilon = 1.0 /
- static_cast<double>(internalQueryPlanEvaluationWorks);
+ // Just enough to break a tie. Must be small enough to ensure that a more productive
+ // plan doesn't lose to a less productive plan due to tie breaking.
+ static const double epsilon = std::min(1.0 / static_cast<double>(10 * workUnits), 1e-4);
// We prefer covered projections.
//