From d8ee6353312a5639ae56454be62066d602eff818 Mon Sep 17 00:00:00 2001 From: David Storch Date: Thu, 18 Feb 2016 18:39:39 -0500 Subject: SERVER-22407 make COUNT_SCAN return RID_AND_OBJ instead of OWNED_OBJ Fixes most of a 7% perf regression for COUNT_SCAN plans. --- src/mongo/db/exec/count_scan.cpp | 4 +--- src/mongo/db/exec/count_scan.h | 5 +++-- 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(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. -- cgit v1.2.1