-
Type: Improvement
-
Resolution: Duplicate
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
Query Integration
Was doing some experimentation on the tsbs dataset and I believe I encountered a bug with the UNPACK_TS_BUCKET stage. If you have a $project by a follow $count, the UNPACK_TS_BUCKET stage includes every field in the projection even though these fields aren't needed to produce the final result.
Query 1:
{ "$match" : { "time" : { "$lt" : ISODate("2016-01-18T01:49:23Z") } } }, { "$project" : { "_id" : 1, "tags" : 1, "usage_softirq" : 1, "usage_steal" : 1, "usage_guest" : 1 } }, { "$count" : "count" }
Query 2:
{ "$match" : { "time" : { "$lt" : ISODate("2016-01-18T01:49:23Z") } } }, { "$count" : "count" }
Partial explain diff:
Query1:
"inputStage" : { "stage" : "UNPACK_TS_BUCKET", "planNodeId" : 2, "include" : [ "_id", "time", "usage_guest", "usage_softirq", "usage_steal", "tags" ], "computedMetaProjFields" : [ ], "includeMeta" : true,
Query2:
"inputStage" : { "stage" : "UNPACK_TS_BUCKET", "planNodeId" : 2, "include" : [ "time" ], "computedMetaProjFields" : [ ], "includeMeta" : false,
Query1 executes in ~5.5s with featureFlagTsInSbeFull while Query2 executes in ~2s with featureFlagTsInSbeFull
- duplicates
-
SERVER-13703 Presence of extraneous $project causes a less efficient plan to be used
- Backlog