summaryrefslogtreecommitdiff
path: root/src/mongo/db/query/plan_enumerator.h
diff options
context:
space:
mode:
authorDavid Storch <david.storch@10gen.com>2014-03-15 11:59:28 -0400
committerDavid Storch <david.storch@10gen.com>2014-03-15 14:46:12 -0400
commit5a03d4cd7c591f43224f90669c3f2b38472567c3 (patch)
treee87914f7f564da583450d02252dd582c598fbc85 /src/mongo/db/query/plan_enumerator.h
parent35d246c14208ebdba5482ccfdd17f83a3961715b (diff)
downloadmongo-5a03d4cd7c591f43224f90669c3f2b38472567c3.tar.gz
SERVER-13184 limit number of enumerated plans for an OR
Diffstat (limited to 'src/mongo/db/query/plan_enumerator.h')
-rw-r--r--src/mongo/db/query/plan_enumerator.h19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/mongo/db/query/plan_enumerator.h b/src/mongo/db/query/plan_enumerator.h
index ccbd7e5f373..7f2f60108c6 100644
--- a/src/mongo/db/query/plan_enumerator.h
+++ b/src/mongo/db/query/plan_enumerator.h
@@ -42,6 +42,7 @@ namespace mongo {
struct PlanEnumeratorParams {
PlanEnumeratorParams() : intersect(false),
+ maxSolutionsPerOr(internalQueryEnumerationMaxOrSolutions),
maxIntersectPerAnd(internalQueryEnumerationMaxIntersectPerAnd) { }
// Do we provide solutions that use more indices than the minimum required to provide
@@ -54,6 +55,11 @@ namespace mongo {
// Not owned here.
const vector<IndexEntry>* indices;
+ // How many plans are we willing to ouput from an OR? We currently consider
+ // all possibly OR plans, which means the product of the number of possibilities
+ // for each clause of the OR. This could grow disastrously large.
+ size_t maxSolutionsPerOr;
+
// How many intersect plans are we willing to output from an AND? Given that we pursue an
// all-pairs approach, we could wind up creating a lot of enumeration possibilities for
// certain inputs.
@@ -181,12 +187,16 @@ namespace mongo {
};
struct OrAssignment {
+ OrAssignment() : counter(0) { }
+
+ // Each child of an OR must be indexed for the OR to be indexed. When an OR moves to a
+ // subsequent state it just asks all its children to move their states forward.
+
// Must use all of subnodes.
vector<MemoID> subnodes;
- // No enumeration state. Each child of an OR must be indexed for the OR to be indexed.
- // When an OR moves to a subsequent state it just asks all its children to move their
- // states forward.
+ // The number of OR states that we've enumerated so far.
+ size_t counter;
};
// This is used by AndAssignment and is not an actual assignment.
@@ -387,6 +397,9 @@ namespace mongo {
// Do we output >1 index per AND (index intersection)?
bool _ixisect;
+ // How many enumerations are we willing to produce from each OR?
+ size_t _orLimit;
+
// How many things do we want from each AND?
size_t _intersectLimit;
};