From 82e7dd7ff94e95c0a4a3814db015fc4eac9e83ab Mon Sep 17 00:00:00 2001 From: qw4990 Date: Mon, 5 Dec 2022 13:59:07 +0800 Subject: [PATCH] fixup --- planner/core/plan_cost_ver2.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/planner/core/plan_cost_ver2.go b/planner/core/plan_cost_ver2.go index b53d53c845c45..29524a345a3e1 100644 --- a/planner/core/plan_cost_ver2.go +++ b/planner/core/plan_cost_ver2.go @@ -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))