Skip to content

Commit

Permalink
executor: reuse memory in the deleteSingleTableByChunk (#54082)
Browse files Browse the repository at this point in the history
close #54080
  • Loading branch information
hawkingrei authored Jun 18, 2024
1 parent dfa6b7c commit f568b21
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/executor/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ func (e *DeleteExec) deleteSingleTableByChunk(ctx context.Context) error {
batchDelete := e.Ctx().GetSessionVars().BatchDelete && !e.Ctx().GetSessionVars().InTxn() &&
variable.EnableBatchDML.Load() && batchDMLSize > 0
fields := exec.RetTypes(e.Children(0))
datumRow := make([]types.Datum, 0, len(fields))
chk := exec.TryNewCacheChunk(e.Children(0))
columns := e.Children(0).Schema().Columns
if len(columns) != len(fields) {
Expand Down Expand Up @@ -127,8 +128,6 @@ func (e *DeleteExec) deleteSingleTableByChunk(ctx context.Context) error {
}
rowCount = 0
}

datumRow := make([]types.Datum, 0, len(fields))
for i, field := range fields {
if columns[i].ID == model.ExtraPhysTblID {
continue
Expand All @@ -143,6 +142,7 @@ func (e *DeleteExec) deleteSingleTableByChunk(ctx context.Context) error {
return err
}
rowCount++
datumRow = datumRow[:0]
}
chk = chunk.Renew(chk, e.MaxChunkSize())
if txn, _ := e.Ctx().Txn(false); txn != nil {
Expand Down

0 comments on commit f568b21

Please sign in to comment.