summaryrefslogtreecommitdiff
path: root/src/mongo/db/query/query_planner.h
diff options
context:
space:
mode:
authorHari Khalsa <hkhalsa@10gen.com>2013-10-29 21:41:09 -0400
committerHari Khalsa <hkhalsa@10gen.com>2013-10-30 16:07:48 -0400
commit67defc7ee10099e727a6091bbd0ff154e2908b00 (patch)
tree43abaedf20ddf0c58e0bf02eebdb92e3622477e8 /src/mongo/db/query/query_planner.h
parenta154946a48b3fea77747f810ff60dce734e9b0dd (diff)
downloadmongo-67defc7ee10099e727a6091bbd0ff154e2908b00.tar.gz
SERVER-10026 sort with improved sort analysis
Diffstat (limited to 'src/mongo/db/query/query_planner.h')
-rw-r--r--src/mongo/db/query/query_planner.h32
1 files changed, 31 insertions, 1 deletions
diff --git a/src/mongo/db/query/query_planner.h b/src/mongo/db/query/query_planner.h
index 3bb7409c511..26e4293459b 100644
--- a/src/mongo/db/query/query_planner.h
+++ b/src/mongo/db/query/query_planner.h
@@ -120,7 +120,7 @@ namespace mongo {
/**
* Return a CollectionScanNode that scans as requested in 'query'.
*/
- static QuerySolution* makeCollectionScan(const CanonicalQuery& query, bool tailable);
+ static QuerySolution* makeCollectionScan(const CanonicalQuery& query, bool tailable, size_t options);
//
// Indexed Data Access methods.
@@ -209,6 +209,15 @@ namespace mongo {
static void finishLeafNode(QuerySolutionNode* node, const IndexEntry& index);
//
+ // Helpers for creating a sort.
+ //
+
+ /**
+ * XXX
+ */
+ static void getBoundsForSort(const CanonicalQuery& query, SortNode* node);
+
+ //
// Analysis of Data Access
//
@@ -227,7 +236,28 @@ namespace mongo {
* Caller owns the returned QuerySolution.
*/
static QuerySolution* analyzeDataAccess(const CanonicalQuery& query,
+ size_t options,
QuerySolutionNode* solnRoot);
+
+ /**
+ * Return a plan that uses the provided index as a proxy for a collection scan.
+ */
+ static QuerySolution* scanWholeIndex(const IndexEntry& index, size_t options,
+ const CanonicalQuery& query);
+
+ /**
+ * XXX
+ */
+ static void reverseScans(QuerySolutionNode* root);
+
+ /**
+ * Assumes each OIL in bounds is increasing.
+ *
+ * Aligns OILs (and bounds) according to the kp direction * the scanDir.
+ */
+ static void alignBounds(IndexBounds* bounds, const BSONObj& kp, int scanDir = 1);
+
+ static bool providesSort(const CanonicalQuery& query, const BSONObj& kp);
};
} // namespace mongo