Skip to content

Commit

Permalink
Merge pull request #61895 from RaduBerinde/backport20.2-61863
Browse files Browse the repository at this point in the history
release-20.2: sql: don't save memo unnecessarily
  • Loading branch information
RaduBerinde authored Mar 13, 2021
2 parents 2da5924 + 6a3c663 commit d4a049e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pkg/sql/plan.go
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ type planTop struct {
planComponents

// mem/catalog retains the memo and catalog that were used to create the
// plan.
// plan. Only set if savePlanForStats or savePlanString is true.
mem *memo.Memo
catalog *optCatalog

Expand Down
6 changes: 4 additions & 2 deletions pkg/sql/plan_opt.go
Original file line number Diff line number Diff line change
Expand Up @@ -598,8 +598,6 @@ func (opc *optPlanningCtx) runExecBuilder(

planTop.planComponents = *result
planTop.explainPlan = explainPlan
planTop.mem = mem
planTop.catalog = &opc.catalog
planTop.codec = codec
planTop.stmt = stmt
planTop.flags = opc.flags
Expand All @@ -612,5 +610,9 @@ func (opc *optPlanningCtx) runExecBuilder(
if containsFullIndexScan {
planTop.flags.Set(planFlagContainsFullIndexScan)
}
if planTop.savePlanString || planTop.savePlanForStats {
planTop.mem = mem
planTop.catalog = &opc.catalog
}
return nil
}

0 comments on commit d4a049e

Please sign in to comment.