summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Storch <david.storch@10gen.com>2016-02-18 18:39:39 -0500
committerDavid Storch <david.storch@10gen.com>2016-02-22 16:12:45 -0500
commitd8ee6353312a5639ae56454be62066d602eff818 (patch)
tree294c2fb7091a8c3d41afa9544bbb137ab0ff393b
parent02fd42496cb871062d27faf0e419d514fdbb1a9b (diff)
downloadmongo-d8ee6353312a5639ae56454be62066d602eff818.tar.gz
SERVER-22407 make COUNT_SCAN return RID_AND_OBJ instead of OWNED_OBJ
Fixes most of a 7% perf regression for COUNT_SCAN plans.
-rw-r--r--src/mongo/db/exec/count_scan.cpp4
-rw-r--r--src/mongo/db/exec/count_scan.h5
2 files changed, 4 insertions, 5 deletions
diff --git a/src/mongo/db/exec/count_scan.cpp b/src/mongo/db/exec/count_scan.cpp
index e65e7977c55..e460854542a 100644
--- a/src/mongo/db/exec/count_scan.cpp
+++ b/src/mongo/db/exec/count_scan.cpp
@@ -106,9 +106,7 @@ PlanStage::StageState CountScan::doWork(WorkingSetID* out) {
}
WorkingSetID id = _workingSet->allocate();
- WorkingSetMember* member = _workingSet->get(id);
- member->obj = Snapshotted<BSONObj>(SnapshotId(), BSONObj().getOwned());
- member->transitionToOwnedObj();
+ _workingSet->transitionToRecordIdAndObj(id);
*out = id;
return PlanStage::ADVANCED;
}
diff --git a/src/mongo/db/exec/count_scan.h b/src/mongo/db/exec/count_scan.h
index 7d40003fc4d..f53c5e3ab0f 100644
--- a/src/mongo/db/exec/count_scan.h
+++ b/src/mongo/db/exec/count_scan.h
@@ -58,8 +58,9 @@ struct CountScanParams {
/**
* Used by the count command. Scans an index from a start key to an end key. Creates a
- * WorkingSetMember for each matching index key in OWNED_OBJ state. It has an owned empty object
- * with a null snapshot id rather than real data, since all we need is the count.
+ * WorkingSetMember for each matching index key in RID_AND_OBJ state. It has a null record id and an
+ * empty object with a null snapshot id rather than real data. Returning real data is unnecessary
+ * since all we need is the count.
*
* Only created through the getExecutorCount() path, as count is the only operation that doesn't
* care about its data.