Skip to content

Commit

Permalink
planner: update the cost formula of IndexJoin+IndexLookup (#39617)
Browse files Browse the repository at this point in the history
ref #35240
  • Loading branch information
qw4990 authored Dec 6, 2022
1 parent 46ee6af commit 1ddc592
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions planner/core/plan_cost_ver2.go
Original file line number Diff line number Diff line change
Expand Up @@ -593,6 +593,11 @@ func (p *PhysicalIndexJoin) getIndexJoinCostVer2(taskType property.TaskType, opt
// Use an empirical value batchRatio to handle this now.
// TODO: remove this empirical value.
batchRatio := 6.0
if _, isIndexLookUp := probe.(*PhysicalIndexLookUpReader); isIndexLookUp {
// IndexJoin + IndexLookUp has the risks to cause massive double-read requests,
// set the batchRatio to a lower value in this case for safety.
batchRatio = 1.5
}
probeCost := divCostVer2(mulCostVer2(probeChildCost, buildRows), batchRatio)

p.planCostVer2 = sumCostVer2(startCost, buildChildCost, buildFilterCost, buildTaskCost, divCostVer2(sumCostVer2(probeCost, probeFilterCost, hashTableCost), probeConcurrency))
Expand Down

0 comments on commit 1ddc592

Please sign in to comment.