Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

planner: update the cost formula of IndexJoin+IndexLookup (#39617) #39652

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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