Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-75602

Do not use the TS_MODIFY plan for an empty delete filter for multi delete

    XMLWordPrintableJSON

Details

    • Icon: Task Task
    • Resolution: Fixed
    • Icon: Major - P3 Major - P3
    • 7.0.0-rc0
    • None
    • None
    • None
    • Fully Compatible
    • Execution Team 2023-04-17

    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.

      Attachments

        Activity

          People

            yoonsoo.kim@mongodb.com Yoon Soo Kim
            yoonsoo.kim@mongodb.com Yoon Soo Kim
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: