[SERVER-75602] Do not use the TS_MODIFY plan for an empty delete filter for multi delete Created: 03/Apr/23  Updated: 29/Oct/23  Resolved: 05/Apr/23

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 7.0.0-rc0

Type: Task Priority: Major - P3
Reporter: Yoon Soo Kim Assignee: Yoon Soo Kim
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Sprint: Execution Team 2023-04-17
Participants:

 Description   

We use a TS_MODIFY plan for an empty filter, which means “delete all”, when a timeseries collection does not define a meta field.

> db.createCollection("ts", {timeseries: {timeField: "t"}});
{ "ok" : 1 }
> db.ts.insert({t: new ISODate(), f: 1});
WriteResult({ "nInserted" : 1 })
> db.runCommand({explain: {delete: "ts", deletes: [{q: {}, limit: 0}]}, verbosity: "queryPlanner"});
		"winningPlan" : {
			"stage" : "TS_MODIFY",
			"opType" : "deleteMany",
			"bucketFilter" : {
 
 
			},
			"residualFilter" : {
 
 
			},
			"inputStage" : {
				"stage" : "COLLSCAN",
				"direction" : "forward"
			}
		},

This would be better to not be a TS_MODIFY plan which will unpack every bucket. When there’s a meta field defined, we use BATCHED_DELETE.



 Comments   
Comment by Githook User [ 05/Apr/23 ]

Author:

{'name': 'Yoonsoo Kim', 'email': 'yoonsoo.kim@mongodb.com', 'username': 'yun-soo'}

Message: SERVER-75602 Do not use the TS_MODIFY plan for an empty delete query for multi delete
Branch: master
https://github.com/mongodb/mongo/commit/381ce8362cf0ebfdd7777a190cf0cb7a1ee3f704

Generated at Thu Feb 08 06:30:36 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.