From 7c4610067a0ab99964528a3db0b75467249a5388 Mon Sep 17 00:00:00 2001 From: Yuanjia Zhang Date: Wed, 23 Nov 2022 14:47:58 +0800 Subject: [PATCH] planner: update cost formulas of Index*Join of model2 (#39296) ref pingcap/tidb#35240 --- executor/explainfor_test.go | 24 +++--- planner/core/plan_cost_ver2.go | 44 +++++++---- .../core/testdata/integration_suite_out.json | 8 +- .../core/testdata/join_reorder_suite_out.json | 74 +++++++++---------- .../core/testdata/partition_pruner_out.json | 8 +- planner/core/testdata/plan_suite_out.json | 6 +- 6 files changed, 90 insertions(+), 74 deletions(-) diff --git a/executor/explainfor_test.go b/executor/explainfor_test.go index 85652a5f04ddb..4cf45d998dac1 100644 --- a/executor/explainfor_test.go +++ b/executor/explainfor_test.go @@ -462,12 +462,12 @@ func TestPointGetUserVarPlanCache(t *testing.T) { tk.Session().SetSessionManager(&testkit.MockSessionManager{PS: ps}) tk.MustQuery(fmt.Sprintf("explain for connection %d", tkProcess.ID)).Check(testkit.Rows( // can use idx_a `Projection_9 1.00 root test.t1.a, test.t1.b, test.t2.a, test.t2.b`, - `└─MergeJoin_10 1.00 root inner join, left key:test.t2.a, right key:test.t1.a`, - ` ├─Selection_42(Build) 10.00 root eq(test.t1.a, 1)`, - ` │ └─TableReader_41 10.00 root data:TableRangeScan_40`, - ` │ └─TableRangeScan_40 10.00 cop[tikv] table:t1 range:[1,1], keep order:true, stats:pseudo`, - ` └─Selection_39(Probe) 0.80 root not(isnull(test.t2.a))`, - ` └─Point_Get_38 1.00 root table:t2, index:idx_a(a) `)) + `└─IndexJoin_17 1.00 root inner join, inner:TableReader_13, outer key:test.t2.a, inner key:test.t1.a, equal cond:eq(test.t2.a, test.t1.a)`, + ` ├─Selection_44(Build) 0.80 root not(isnull(test.t2.a))`, + ` │ └─Point_Get_43 1.00 root table:t2, index:idx_a(a) `, + ` └─TableReader_13(Probe) 0.00 root data:Selection_12`, + ` └─Selection_12 0.00 cop[tikv] eq(test.t1.a, 1)`, + ` └─TableRangeScan_11 0.80 cop[tikv] table:t1 range: decided by [eq(test.t1.a, test.t2.a)], keep order:false, stats:pseudo`)) tk.MustExec("set @a=2") tk.MustQuery("execute stmt using @a").Check(testkit.Rows( @@ -478,12 +478,12 @@ func TestPointGetUserVarPlanCache(t *testing.T) { tk.Session().SetSessionManager(&testkit.MockSessionManager{PS: ps}) tk.MustQuery(fmt.Sprintf("explain for connection %d", tkProcess.ID)).Check(testkit.Rows( // can use idx_a `Projection_9 1.00 root test.t1.a, test.t1.b, test.t2.a, test.t2.b`, - `└─MergeJoin_10 1.00 root inner join, left key:test.t2.a, right key:test.t1.a`, - ` ├─Selection_42(Build) 10.00 root eq(test.t1.a, 2)`, - ` │ └─TableReader_41 10.00 root data:TableRangeScan_40`, - ` │ └─TableRangeScan_40 10.00 cop[tikv] table:t1 range:[2,2], keep order:true, stats:pseudo`, - ` └─Selection_39(Probe) 0.80 root not(isnull(test.t2.a))`, - ` └─Point_Get_38 1.00 root table:t2, index:idx_a(a) `)) + `└─IndexJoin_17 1.00 root inner join, inner:TableReader_13, outer key:test.t2.a, inner key:test.t1.a, equal cond:eq(test.t2.a, test.t1.a)`, + ` ├─Selection_44(Build) 0.80 root not(isnull(test.t2.a))`, + ` │ └─Point_Get_43 1.00 root table:t2, index:idx_a(a) `, + ` └─TableReader_13(Probe) 0.00 root data:Selection_12`, + ` └─Selection_12 0.00 cop[tikv] eq(test.t1.a, 2)`, + ` └─TableRangeScan_11 0.80 cop[tikv] table:t1 range: decided by [eq(test.t1.a, test.t2.a)], keep order:false, stats:pseudo`)) tk.MustQuery("execute stmt using @a").Check(testkit.Rows( "2 4 2 2", )) diff --git a/planner/core/plan_cost_ver2.go b/planner/core/plan_cost_ver2.go index 18b1606042448..733c4c6845098 100644 --- a/planner/core/plan_cost_ver2.go +++ b/planner/core/plan_cost_ver2.go @@ -534,57 +534,73 @@ func (p *PhysicalHashJoin) getPlanCostVer2(taskType property.TaskType, option *P return p.planCostVer2.label(p), nil } -// getPlanCostVer2 returns the plan-cost of this sub-plan, which is: -// plan-cost = build-child-cost + build-filter-cost + -// (probe-cost + probe-filter-cost) / concurrency -// probe-cost = probe-child-cost * build-rows / batchRatio -func (p *PhysicalIndexJoin) getPlanCostVer2(taskType property.TaskType, option *PlanCostOption) (costVer2, error) { +func (p *PhysicalIndexJoin) getIndexJoinCostVer2(taskType property.TaskType, option *PlanCostOption, indexJoinType int) (costVer2, error) { if p.planCostInit && !hasCostFlag(option.CostFlag, CostFlagRecalculate) { return p.planCostVer2, nil } build, probe := p.children[1-p.InnerChildIdx], p.children[p.InnerChildIdx] buildRows := getCardinality(build, option.CostFlag) + buildRowSize := getAvgRowSize(build.Stats(), build.Schema().Columns) probeRowsOne := getCardinality(probe, option.CostFlag) probeRowsTot := probeRowsOne * buildRows + probeRowSize := getAvgRowSize(probe.Stats(), probe.Schema().Columns) buildFilters, probeFilters := p.LeftConditions, p.RightConditions probeConcurrency := float64(p.ctx.GetSessionVars().IndexLookupJoinConcurrency()) cpuFactor := getTaskCPUFactorVer2(p, taskType) - requestFactor := getTaskRequestFactorVer2(p, taskType) + memFactor := getTaskMemFactorVer2(p, taskType) buildFilterCost := filterCostVer2(option, buildRows, buildFilters, cpuFactor) buildChildCost, err := build.getPlanCostVer2(taskType, option) if err != nil { return zeroCostVer2, err } + buildTaskCost := newCostVer2(option, cpuFactor, + buildRows*10*cpuFactor.Value, + "cpu(%v*10*%v)", buildRows, cpuFactor) probeFilterCost := filterCostVer2(option, probeRowsTot, probeFilters, cpuFactor) probeChildCost, err := probe.getPlanCostVer2(taskType, option) if err != nil { return zeroCostVer2, err } + + var hashTableCost costVer2 + switch indexJoinType { + case 1: // IndexHashJoin + hashTableCost = hashBuildCostVer2(option, buildRows, buildRowSize, cols2Exprs(p.RightJoinKeys), cpuFactor, memFactor) + case 2: // IndexMergeJoin + hashTableCost = newZeroCostVer2(traceCost(option)) + default: // IndexJoin + hashTableCost = hashBuildCostVer2(option, probeRowsTot, probeRowSize, cols2Exprs(p.LeftJoinKeys), cpuFactor, memFactor) + } + // IndexJoin executes a batch of rows at a time, so the actual cost of this part should be // `innerCostPerBatch * numberOfBatches` instead of `innerCostPerRow * numberOfOuterRow`. // Use an empirical value batchRatio to handle this now. // TODO: remove this empirical value. - batchRatio := 1800.0 + batchRatio := 6.0 probeCost := divCostVer2(mulCostVer2(probeChildCost, buildRows), batchRatio) - numTasks := math.Max(buildRows/batchRatio, 0.001) - doubleReadCost := doubleReadCostVer2(option, numTasks, requestFactor) - p.planCostVer2 = sumCostVer2(buildChildCost, buildFilterCost, divCostVer2(sumCostVer2(probeCost, probeFilterCost, doubleReadCost), probeConcurrency)) + p.planCostVer2 = sumCostVer2(buildChildCost, buildFilterCost, buildTaskCost, divCostVer2(sumCostVer2(probeCost, probeFilterCost, hashTableCost), probeConcurrency)) p.planCostInit = true return p.planCostVer2.label(p), nil } +// getPlanCostVer2 returns the plan-cost of this sub-plan, which is: +// plan-cost = build-child-cost + build-filter-cost + +// (probe-cost + probe-filter-cost) / concurrency +// probe-cost = probe-child-cost * build-rows / batchRatio +func (p *PhysicalIndexJoin) getPlanCostVer2(taskType property.TaskType, option *PlanCostOption) (costVer2, error) { + return p.getIndexJoinCostVer2(taskType, option, 0) +} + func (p *PhysicalIndexHashJoin) getPlanCostVer2(taskType property.TaskType, option *PlanCostOption) (costVer2, error) { - // TODO: distinguish IndexHashJoin with IndexJoin - return p.PhysicalIndexJoin.getPlanCostVer2(taskType, option) + return p.getIndexJoinCostVer2(taskType, option, 1) } func (p *PhysicalIndexMergeJoin) getPlanCostVer2(taskType property.TaskType, option *PlanCostOption) (costVer2, error) { - // TODO: distinguish IndexMergeJoin with IndexJoin - return p.PhysicalIndexJoin.getPlanCostVer2(taskType, option) + return p.getIndexJoinCostVer2(taskType, option, 2) } // getPlanCostVer2 returns the plan-cost of this sub-plan, which is: diff --git a/planner/core/testdata/integration_suite_out.json b/planner/core/testdata/integration_suite_out.json index b7f0c9ed9cb95..3ab44fabad3ee 100644 --- a/planner/core/testdata/integration_suite_out.json +++ b/planner/core/testdata/integration_suite_out.json @@ -1502,8 +1502,8 @@ { "SQL": "explain format = 'brief' SELECT t1.pk FROM t1 INNER JOIN t2 ON t1.col1 = t2.pk INNER JOIN t3 ON t1.col3 = t3.pk WHERE t2.col1 IN ('a' , 'b') AND t3.keycol = 'c' AND t1.col2 = 'a' AND t1.col1 != 'abcdef' AND t1.col1 != 'aaaaaa'", "Plan": [ - "IndexJoin 13.81 root inner join, inner:IndexLookUp, outer key:test.t1.col1, inner key:test.t2.pk, equal cond:eq(test.t1.col1, test.t2.pk)", - "├─IndexJoin(Build) 12.50 root inner join, inner:IndexLookUp, outer key:test.t3.pk, inner key:test.t1.col3, equal cond:eq(test.t3.pk, test.t1.col3)", + "IndexHashJoin 13.81 root inner join, inner:IndexLookUp, outer key:test.t1.col1, inner key:test.t2.pk, equal cond:eq(test.t1.col1, test.t2.pk)", + "├─IndexHashJoin(Build) 12.50 root inner join, inner:IndexLookUp, outer key:test.t3.pk, inner key:test.t1.col3, equal cond:eq(test.t3.pk, test.t1.col3)", "│ ├─IndexLookUp(Build) 10.00 root ", "│ │ ├─IndexRangeScan(Build) 10.00 cop[tikv] table:t3, index:keycol(keycol, pad1, pad2) range:[\"c\",\"c\"], keep order:false, stats:pseudo", "│ │ └─TableRowIDScan(Probe) 10.00 cop[tikv] table:t3 keep order:false, stats:pseudo", @@ -1522,8 +1522,8 @@ { "SQL": "explain format = 'brief' SELECT t1.pk FROM t1 LEFT JOIN t2 ON t1.col1 = t2.pk LEFT JOIN t3 ON t1.col3 = t3.pk WHERE t2.col1 IN ('a' , 'b') AND t3.keycol = 'c' AND t1.col2 = 'a' AND t1.col1 != 'abcdef' AND t1.col1 != 'aaaaaa'", "Plan": [ - "IndexJoin 13.81 root inner join, inner:IndexLookUp, outer key:test.t1.col1, inner key:test.t2.pk, equal cond:eq(test.t1.col1, test.t2.pk)", - "├─IndexJoin(Build) 12.50 root inner join, inner:IndexLookUp, outer key:test.t3.pk, inner key:test.t1.col3, equal cond:eq(test.t3.pk, test.t1.col3)", + "IndexHashJoin 13.81 root inner join, inner:IndexLookUp, outer key:test.t1.col1, inner key:test.t2.pk, equal cond:eq(test.t1.col1, test.t2.pk)", + "├─IndexHashJoin(Build) 12.50 root inner join, inner:IndexLookUp, outer key:test.t3.pk, inner key:test.t1.col3, equal cond:eq(test.t3.pk, test.t1.col3)", "│ ├─IndexLookUp(Build) 10.00 root ", "│ │ ├─IndexRangeScan(Build) 10.00 cop[tikv] table:t3, index:keycol(keycol, pad1, pad2) range:[\"c\",\"c\"], keep order:false, stats:pseudo", "│ │ └─TableRowIDScan(Probe) 10.00 cop[tikv] table:t3 keep order:false, stats:pseudo", diff --git a/planner/core/testdata/join_reorder_suite_out.json b/planner/core/testdata/join_reorder_suite_out.json index 7289fbd043d00..e9bdcc1010cb6 100644 --- a/planner/core/testdata/join_reorder_suite_out.json +++ b/planner/core/testdata/join_reorder_suite_out.json @@ -6297,7 +6297,7 @@ "Projection 1.00 root test.t1.a, Column#14", "└─Apply 1.00 root CARTESIAN left outer join", " ├─HashAgg(Build) 1.00 root funcs:min(test.t1.a)->Column#10, funcs:firstrow(test.t1.a)->test.t1.a", - " │ └─IndexJoin 3.75 root inner join, inner:IndexReader, outer key:test.t3.a, inner key:test.t1.a, equal cond:eq(test.t3.a, test.t1.a)", + " │ └─IndexHashJoin 3.75 root inner join, inner:IndexReader, outer key:test.t3.a, inner key:test.t1.a, equal cond:eq(test.t3.a, test.t1.a)", " │ ├─IndexReader(Build) 3.00 root index:IndexFullScan", " │ │ └─IndexFullScan 3.00 cop[tikv] table:t3, index:a(a) keep order:false", " │ └─IndexReader(Probe) 3.75 root index:Selection", @@ -6429,7 +6429,7 @@ "SQL": "select /*+ straight_join() */ t1.a, (select min(t2.a) from t2) from t1 join t3 on t1.a = t3.a;", "Plan": [ "Projection 3.75 root test.t1.a, ->Column#14", - "└─IndexJoin 3.75 root inner join, inner:IndexReader, outer key:test.t3.a, inner key:test.t1.a, equal cond:eq(test.t3.a, test.t1.a)", + "└─IndexHashJoin 3.75 root inner join, inner:IndexReader, outer key:test.t3.a, inner key:test.t1.a, equal cond:eq(test.t3.a, test.t1.a)", " ├─IndexReader(Build) 3.00 root index:IndexFullScan", " │ └─IndexFullScan 3.00 cop[tikv] table:t3, index:a(a) keep order:false", " └─IndexReader(Probe) 3.75 root index:Selection", @@ -6916,7 +6916,7 @@ "Projection 1.00 root test.t1.a, Column#14", "└─Apply 1.00 root CARTESIAN left outer join", " ├─HashAgg(Build) 1.00 root funcs:min(test.t1.a)->Column#10, funcs:firstrow(test.t1.a)->test.t1.a", - " │ └─IndexJoin 3.75 root inner join, inner:IndexReader, outer key:test.t3.a, inner key:test.t1.a, equal cond:eq(test.t3.a, test.t1.a)", + " │ └─IndexHashJoin 3.75 root inner join, inner:IndexReader, outer key:test.t3.a, inner key:test.t1.a, equal cond:eq(test.t3.a, test.t1.a)", " │ ├─IndexReader(Build) 3.00 root index:IndexFullScan", " │ │ └─IndexFullScan 3.00 cop[tikv] table:t3, index:a(a) keep order:false", " │ └─IndexReader(Probe) 3.75 root index:Selection", @@ -6936,7 +6936,7 @@ "Projection 1.00 root test.t1.a, Column#14", "└─Apply 1.00 root CARTESIAN left outer join", " ├─HashAgg(Build) 1.00 root funcs:min(test.t1.a)->Column#10, funcs:firstrow(test.t1.a)->test.t1.a", - " │ └─IndexJoin 3.75 root inner join, inner:IndexReader, outer key:test.t3.a, inner key:test.t1.a, equal cond:eq(test.t3.a, test.t1.a)", + " │ └─IndexHashJoin 3.75 root inner join, inner:IndexReader, outer key:test.t3.a, inner key:test.t1.a, equal cond:eq(test.t3.a, test.t1.a)", " │ ├─IndexReader(Build) 3.00 root index:IndexFullScan", " │ │ └─IndexFullScan 3.00 cop[tikv] table:t3, index:a(a) keep order:false", " │ └─IndexReader(Probe) 3.75 root index:Selection", @@ -6958,7 +6958,7 @@ "Projection 1.00 root test.t1.a, Column#14", "└─Apply 1.00 root CARTESIAN left outer join", " ├─HashAgg(Build) 1.00 root funcs:min(test.t1.a)->Column#10, funcs:firstrow(test.t1.a)->test.t1.a", - " │ └─IndexJoin 3.75 root inner join, inner:IndexReader, outer key:test.t3.a, inner key:test.t1.a, equal cond:eq(test.t3.a, test.t1.a)", + " │ └─IndexHashJoin 3.75 root inner join, inner:IndexReader, outer key:test.t3.a, inner key:test.t1.a, equal cond:eq(test.t3.a, test.t1.a)", " │ ├─IndexReader(Build) 3.00 root index:IndexFullScan", " │ │ └─IndexFullScan 3.00 cop[tikv] table:t3, index:a(a) keep order:false", " │ └─IndexReader(Probe) 3.75 root index:Selection", @@ -6980,7 +6980,7 @@ "Projection 1.00 root test.t1.a, Column#14", "└─Apply 1.00 root CARTESIAN left outer join", " ├─HashAgg(Build) 1.00 root funcs:min(test.t1.a)->Column#10, funcs:firstrow(test.t1.a)->test.t1.a", - " │ └─IndexJoin 3.75 root inner join, inner:IndexReader, outer key:test.t3.a, inner key:test.t1.a, equal cond:eq(test.t3.a, test.t1.a)", + " │ └─IndexHashJoin 3.75 root inner join, inner:IndexReader, outer key:test.t3.a, inner key:test.t1.a, equal cond:eq(test.t3.a, test.t1.a)", " │ ├─IndexReader(Build) 3.00 root index:IndexFullScan", " │ │ └─IndexFullScan 3.00 cop[tikv] table:t3, index:a(a) keep order:false", " │ └─IndexReader(Probe) 3.75 root index:Selection", @@ -7003,7 +7003,7 @@ "Projection 1.00 root test.t1.a, Column#14", "└─Apply 1.00 root CARTESIAN left outer join", " ├─HashAgg(Build) 1.00 root funcs:min(test.t1.a)->Column#10, funcs:firstrow(test.t1.a)->test.t1.a", - " │ └─IndexJoin 3.75 root inner join, inner:IndexReader, outer key:test.t3.a, inner key:test.t1.a, equal cond:eq(test.t3.a, test.t1.a)", + " │ └─IndexHashJoin 3.75 root inner join, inner:IndexReader, outer key:test.t3.a, inner key:test.t1.a, equal cond:eq(test.t3.a, test.t1.a)", " │ ├─IndexReader(Build) 3.00 root index:IndexFullScan", " │ │ └─IndexFullScan 3.00 cop[tikv] table:t3, index:a(a) keep order:false", " │ └─IndexReader(Probe) 3.75 root index:Selection", @@ -7025,7 +7025,7 @@ "Projection 1.00 root test.t1.a, Column#14", "└─Apply 1.00 root CARTESIAN left outer join", " ├─HashAgg(Build) 1.00 root funcs:min(test.t1.a)->Column#10, funcs:firstrow(test.t1.a)->test.t1.a", - " │ └─IndexJoin 3.75 root inner join, inner:IndexReader, outer key:test.t3.a, inner key:test.t1.a, equal cond:eq(test.t3.a, test.t1.a)", + " │ └─IndexHashJoin 3.75 root inner join, inner:IndexReader, outer key:test.t3.a, inner key:test.t1.a, equal cond:eq(test.t3.a, test.t1.a)", " │ ├─IndexReader(Build) 3.00 root index:IndexFullScan", " │ │ └─IndexFullScan 3.00 cop[tikv] table:t3, index:a(a) keep order:false", " │ └─IndexReader(Probe) 3.75 root index:Selection", @@ -7046,8 +7046,8 @@ "SQL": "select /*+ leading(t4, t3@sel_2) */ * from t1 join t2 on t1.a=t2.a join t4 on t1.b = t4.b where t1.a = (select max(t3.a) from t3 where t1.b = t3.b)", "Plan": [ "HashJoin 4.69 root inner join, equal:[eq(test.t1.b, test.t4.b)]", - "├─IndexJoin(Build) 3.75 root inner join, inner:IndexLookUp, outer key:test.t1.a, inner key:test.t2.a, equal cond:eq(test.t1.a, test.t2.a)", - "│ ├─IndexJoin(Build) 3.00 root inner join, inner:IndexLookUp, outer key:Column#13, inner key:test.t1.a, equal cond:eq(Column#13, test.t1.a), eq(test.t3.b, test.t1.b)", + "├─IndexHashJoin(Build) 3.75 root inner join, inner:IndexLookUp, outer key:test.t1.a, inner key:test.t2.a, equal cond:eq(test.t1.a, test.t2.a)", + "│ ├─IndexHashJoin(Build) 3.00 root inner join, inner:IndexLookUp, outer key:Column#13, inner key:test.t1.a, equal cond:eq(Column#13, test.t1.a), eq(test.t3.b, test.t1.b)", "│ │ ├─Selection(Build) 2.40 root not(isnull(Column#13))", "│ │ │ └─HashAgg 3.00 root group by:test.t3.b, funcs:max(Column#20)->Column#13, funcs:firstrow(test.t3.b)->test.t3.b", "│ │ │ └─TableReader 3.00 root data:HashAgg", @@ -7076,7 +7076,7 @@ "SQL": "select /*+ leading(t4) */ * from t1 join t2 on t1.a=t2.a join t4 on t1.b = t4.b where t1.a = (select max(t3.a) from t3 where t1.b = t3.b)", "Plan": [ "Projection 4.69 root test.t1.a, test.t1.b, test.t2.a, test.t2.b, test.t4.a, test.t4.b", - "└─IndexJoin 4.69 root inner join, inner:IndexLookUp, outer key:test.t1.a, inner key:test.t2.a, equal cond:eq(test.t1.a, test.t2.a)", + "└─IndexHashJoin 4.69 root inner join, inner:IndexLookUp, outer key:test.t1.a, inner key:test.t2.a, equal cond:eq(test.t1.a, test.t2.a)", " ├─HashJoin(Build) 3.75 root inner join, equal:[eq(test.t1.b, test.t3.b) eq(test.t1.a, Column#13)]", " │ ├─Selection(Build) 2.40 root not(isnull(Column#13))", " │ │ └─HashAgg 3.00 root group by:test.t3.b, funcs:max(Column#18)->Column#13, funcs:firstrow(test.t3.b)->test.t3.b", @@ -7102,8 +7102,8 @@ "SQL": "select /*+ leading(t3@sel_2) */ * from t1 join t2 on t1.a=t2.a join t4 on t1.b = t4.b where t1.a = (select max(t3.a) from t3 where t1.b = t3.b)", "Plan": [ "HashJoin 4.69 root inner join, equal:[eq(test.t1.b, test.t4.b)]", - "├─IndexJoin(Build) 3.75 root inner join, inner:IndexLookUp, outer key:test.t1.a, inner key:test.t2.a, equal cond:eq(test.t1.a, test.t2.a)", - "│ ├─IndexJoin(Build) 3.00 root inner join, inner:IndexLookUp, outer key:Column#13, inner key:test.t1.a, equal cond:eq(Column#13, test.t1.a), eq(test.t3.b, test.t1.b)", + "├─IndexHashJoin(Build) 3.75 root inner join, inner:IndexLookUp, outer key:test.t1.a, inner key:test.t2.a, equal cond:eq(test.t1.a, test.t2.a)", + "│ ├─IndexHashJoin(Build) 3.00 root inner join, inner:IndexLookUp, outer key:Column#13, inner key:test.t1.a, equal cond:eq(Column#13, test.t1.a), eq(test.t3.b, test.t1.b)", "│ │ ├─Selection(Build) 2.40 root not(isnull(Column#13))", "│ │ │ └─HashAgg 3.00 root group by:test.t3.b, funcs:max(Column#20)->Column#13, funcs:firstrow(test.t3.b)->test.t3.b", "│ │ │ └─TableReader 3.00 root data:HashAgg", @@ -7131,8 +7131,8 @@ "SQL": "select /*+ leading(t3@sel_2, t2) */ * from t1 join t2 on t1.a=t2.a join t4 on t1.b = t4.b where t1.a = (select max(t3.a) from t3 where t1.b = t3.b)", "Plan": [ "HashJoin 4.69 root inner join, equal:[eq(test.t1.b, test.t4.b)]", - "├─IndexJoin(Build) 3.75 root inner join, inner:IndexLookUp, outer key:test.t1.a, inner key:test.t2.a, equal cond:eq(test.t1.a, test.t2.a)", - "│ ├─IndexJoin(Build) 3.00 root inner join, inner:IndexLookUp, outer key:Column#13, inner key:test.t1.a, equal cond:eq(Column#13, test.t1.a), eq(test.t3.b, test.t1.b)", + "├─IndexHashJoin(Build) 3.75 root inner join, inner:IndexLookUp, outer key:test.t1.a, inner key:test.t2.a, equal cond:eq(test.t1.a, test.t2.a)", + "│ ├─IndexHashJoin(Build) 3.00 root inner join, inner:IndexLookUp, outer key:Column#13, inner key:test.t1.a, equal cond:eq(Column#13, test.t1.a), eq(test.t3.b, test.t1.b)", "│ │ ├─Selection(Build) 2.40 root not(isnull(Column#13))", "│ │ │ └─HashAgg 3.00 root group by:test.t3.b, funcs:max(Column#20)->Column#13, funcs:firstrow(test.t3.b)->test.t3.b", "│ │ │ └─TableReader 3.00 root data:HashAgg", @@ -7161,7 +7161,7 @@ "SQL": "select /*+ leading(t4, t3@sel_2) */ * from t1 join t2 on t1.a=t2.a join t4 on t1.b = t4.b where t1.a > (select min(t3.a) from t3 where t1.b = t3.b)", "Plan": [ "HashJoin 4.69 root inner join, equal:[eq(test.t1.b, test.t4.b)]", - "├─IndexJoin(Build) 3.75 root inner join, inner:IndexLookUp, outer key:test.t1.a, inner key:test.t2.a, equal cond:eq(test.t1.a, test.t2.a)", + "├─IndexHashJoin(Build) 3.75 root inner join, inner:IndexLookUp, outer key:test.t1.a, inner key:test.t2.a, equal cond:eq(test.t1.a, test.t2.a)", "│ ├─HashJoin(Build) 3.00 root inner join, equal:[eq(test.t3.b, test.t1.b)], other cond:gt(test.t1.a, Column#13)", "│ │ ├─Selection(Build) 2.40 root not(isnull(Column#13))", "│ │ │ └─HashAgg 3.00 root group by:test.t3.b, funcs:min(Column#17)->Column#13, funcs:firstrow(test.t3.b)->test.t3.b", @@ -7189,7 +7189,7 @@ "SQL": "select /*+ leading(t4) */ * from t1 join t2 on t1.a=t2.a join t4 on t1.b = t4.b where t1.a > (select min(t3.a) from t3 where t1.b = t3.b)", "Plan": [ "Projection 4.69 root test.t1.a, test.t1.b, test.t2.a, test.t2.b, test.t4.a, test.t4.b", - "└─IndexJoin 4.69 root inner join, inner:IndexLookUp, outer key:test.t1.a, inner key:test.t2.a, equal cond:eq(test.t1.a, test.t2.a)", + "└─IndexHashJoin 4.69 root inner join, inner:IndexLookUp, outer key:test.t1.a, inner key:test.t2.a, equal cond:eq(test.t1.a, test.t2.a)", " ├─HashJoin(Build) 3.75 root inner join, equal:[eq(test.t1.b, test.t3.b)], other cond:gt(test.t1.a, Column#13)", " │ ├─Selection(Build) 2.40 root not(isnull(Column#13))", " │ │ └─HashAgg 3.00 root group by:test.t3.b, funcs:min(Column#18)->Column#13, funcs:firstrow(test.t3.b)->test.t3.b", @@ -7215,7 +7215,7 @@ "SQL": "select /*+ leading(t3@sel_2) */ * from t1 join t2 on t1.a=t2.a join t4 on t1.b = t4.b where t1.a > (select min(t3.a) from t3 where t1.b = t3.b)", "Plan": [ "HashJoin 4.69 root inner join, equal:[eq(test.t1.b, test.t4.b)]", - "├─IndexJoin(Build) 3.75 root inner join, inner:IndexLookUp, outer key:test.t1.a, inner key:test.t2.a, equal cond:eq(test.t1.a, test.t2.a)", + "├─IndexHashJoin(Build) 3.75 root inner join, inner:IndexLookUp, outer key:test.t1.a, inner key:test.t2.a, equal cond:eq(test.t1.a, test.t2.a)", "│ ├─HashJoin(Build) 3.00 root inner join, equal:[eq(test.t3.b, test.t1.b)], other cond:gt(test.t1.a, Column#13)", "│ │ ├─Selection(Build) 2.40 root not(isnull(Column#13))", "│ │ │ └─HashAgg 3.00 root group by:test.t3.b, funcs:min(Column#17)->Column#13, funcs:firstrow(test.t3.b)->test.t3.b", @@ -7242,7 +7242,7 @@ "SQL": "select /*+ leading(t3@sel_2, t2) */ * from t1 join t2 on t1.a=t2.a join t4 on t1.b = t4.b where t1.a > (select min(t3.a) from t3 where t1.b = t3.b)", "Plan": [ "HashJoin 4.69 root inner join, equal:[eq(test.t1.b, test.t4.b)]", - "├─IndexJoin(Build) 3.75 root inner join, inner:IndexLookUp, outer key:test.t1.a, inner key:test.t2.a, equal cond:eq(test.t1.a, test.t2.a)", + "├─IndexHashJoin(Build) 3.75 root inner join, inner:IndexLookUp, outer key:test.t1.a, inner key:test.t2.a, equal cond:eq(test.t1.a, test.t2.a)", "│ ├─HashJoin(Build) 3.00 root inner join, equal:[eq(test.t3.b, test.t1.b)], other cond:gt(test.t1.a, Column#13)", "│ │ ├─Selection(Build) 2.40 root not(isnull(Column#13))", "│ │ │ └─HashAgg 3.00 root group by:test.t3.b, funcs:min(Column#17)->Column#13, funcs:firstrow(test.t3.b)->test.t3.b", @@ -7270,7 +7270,7 @@ "SQL": "select /*+ leading(t4) */ * from t1 join t2 on t1.a=t2.a join t4 on t1.b = t4.b where t1.a in (select t3.a from t3)", "Plan": [ "Projection 5.86 root test.t1.a, test.t1.b, test.t2.a, test.t2.b, test.t4.a, test.t4.b", - "└─IndexJoin 5.86 root inner join, inner:IndexLookUp, outer key:test.t1.a, inner key:test.t2.a, equal cond:eq(test.t1.a, test.t2.a)", + "└─IndexHashJoin 5.86 root inner join, inner:IndexLookUp, outer key:test.t1.a, inner key:test.t2.a, equal cond:eq(test.t1.a, test.t2.a)", " ├─HashJoin(Build) 4.69 root inner join, equal:[eq(test.t1.a, test.t3.a)]", " │ ├─StreamAgg(Build) 3.00 root group by:test.t3.a, funcs:firstrow(test.t3.a)->test.t3.a", " │ │ └─IndexReader 3.00 root index:StreamAgg", @@ -7293,8 +7293,8 @@ { "SQL": "select /*+ leading(t3@sel_2) */ * from t1 join t2 on t1.a=t2.a where t1.a in (select t3.a from t3)", "Plan": [ - "IndexJoin 4.69 root inner join, inner:IndexLookUp, outer key:test.t1.a, inner key:test.t2.a, equal cond:eq(test.t1.a, test.t2.a)", - "├─IndexJoin(Build) 3.75 root inner join, inner:IndexLookUp, outer key:test.t3.a, inner key:test.t1.a, equal cond:eq(test.t3.a, test.t1.a)", + "IndexHashJoin 4.69 root inner join, inner:IndexLookUp, outer key:test.t1.a, inner key:test.t2.a, equal cond:eq(test.t1.a, test.t2.a)", + "├─IndexHashJoin(Build) 3.75 root inner join, inner:IndexLookUp, outer key:test.t3.a, inner key:test.t1.a, equal cond:eq(test.t3.a, test.t1.a)", "│ ├─StreamAgg(Build) 3.00 root group by:test.t3.a, funcs:firstrow(test.t3.a)->test.t3.a", "│ │ └─IndexReader 3.00 root index:StreamAgg", "│ │ └─StreamAgg 3.00 cop[tikv] group by:test.t3.a, ", @@ -7313,8 +7313,8 @@ { "SQL": "select /*+ leading(t2, t3@sel_2) */ * from t1 join t2 on t1.a=t2.a where t1.a in (select t3.a from t3)", "Plan": [ - "IndexJoin 4.69 root inner join, inner:IndexLookUp, outer key:test.t1.a, inner key:test.t2.a, equal cond:eq(test.t1.a, test.t2.a)", - "├─IndexJoin(Build) 3.75 root inner join, inner:IndexLookUp, outer key:test.t3.a, inner key:test.t1.a, equal cond:eq(test.t3.a, test.t1.a)", + "IndexHashJoin 4.69 root inner join, inner:IndexLookUp, outer key:test.t1.a, inner key:test.t2.a, equal cond:eq(test.t1.a, test.t2.a)", + "├─IndexHashJoin(Build) 3.75 root inner join, inner:IndexLookUp, outer key:test.t3.a, inner key:test.t1.a, equal cond:eq(test.t3.a, test.t1.a)", "│ ├─StreamAgg(Build) 3.00 root group by:test.t3.a, funcs:firstrow(test.t3.a)->test.t3.a", "│ │ └─IndexReader 3.00 root index:StreamAgg", "│ │ └─StreamAgg 3.00 cop[tikv] group by:test.t3.a, ", @@ -7335,8 +7335,8 @@ { "SQL": "select /*+ leading(t1, t3@sel_2) */ * from t1 join t2 on t1.a=t2.a where t1.a in (select t3.a from t3)", "Plan": [ - "IndexJoin 4.69 root inner join, inner:IndexLookUp, outer key:test.t1.a, inner key:test.t2.a, equal cond:eq(test.t1.a, test.t2.a)", - "├─IndexJoin(Build) 3.75 root inner join, inner:IndexLookUp, outer key:test.t3.a, inner key:test.t1.a, equal cond:eq(test.t3.a, test.t1.a)", + "IndexHashJoin 4.69 root inner join, inner:IndexLookUp, outer key:test.t1.a, inner key:test.t2.a, equal cond:eq(test.t1.a, test.t2.a)", + "├─IndexHashJoin(Build) 3.75 root inner join, inner:IndexLookUp, outer key:test.t3.a, inner key:test.t1.a, equal cond:eq(test.t3.a, test.t1.a)", "│ ├─StreamAgg(Build) 3.00 root group by:test.t3.a, funcs:firstrow(test.t3.a)->test.t3.a", "│ │ └─IndexReader 3.00 root index:StreamAgg", "│ │ └─StreamAgg 3.00 cop[tikv] group by:test.t3.a, ", @@ -7357,8 +7357,8 @@ { "SQL": "select /*+ leading(t3@sel_2, t2) */ * from t1 join t2 on t1.a=t2.a where t1.a in (select t3.a from t3)", "Plan": [ - "IndexJoin 4.69 root inner join, inner:IndexLookUp, outer key:test.t1.a, inner key:test.t2.a, equal cond:eq(test.t1.a, test.t2.a)", - "├─IndexJoin(Build) 3.75 root inner join, inner:IndexLookUp, outer key:test.t3.a, inner key:test.t1.a, equal cond:eq(test.t3.a, test.t1.a)", + "IndexHashJoin 4.69 root inner join, inner:IndexLookUp, outer key:test.t1.a, inner key:test.t2.a, equal cond:eq(test.t1.a, test.t2.a)", + "├─IndexHashJoin(Build) 3.75 root inner join, inner:IndexLookUp, outer key:test.t3.a, inner key:test.t1.a, equal cond:eq(test.t3.a, test.t1.a)", "│ ├─StreamAgg(Build) 3.00 root group by:test.t3.a, funcs:firstrow(test.t3.a)->test.t3.a", "│ │ └─IndexReader 3.00 root index:StreamAgg", "│ │ └─StreamAgg 3.00 cop[tikv] group by:test.t3.a, ", @@ -7379,8 +7379,8 @@ { "SQL": "select /*+ leading(t3@sel_2, t1) */ * from t1 join t2 on t1.a=t2.a where t1.a in (select t3.a from t3)", "Plan": [ - "IndexJoin 4.69 root inner join, inner:IndexLookUp, outer key:test.t1.a, inner key:test.t2.a, equal cond:eq(test.t1.a, test.t2.a)", - "├─IndexJoin(Build) 3.75 root inner join, inner:IndexLookUp, outer key:test.t3.a, inner key:test.t1.a, equal cond:eq(test.t3.a, test.t1.a)", + "IndexHashJoin 4.69 root inner join, inner:IndexLookUp, outer key:test.t1.a, inner key:test.t2.a, equal cond:eq(test.t1.a, test.t2.a)", + "├─IndexHashJoin(Build) 3.75 root inner join, inner:IndexLookUp, outer key:test.t3.a, inner key:test.t1.a, equal cond:eq(test.t3.a, test.t1.a)", "│ ├─StreamAgg(Build) 3.00 root group by:test.t3.a, funcs:firstrow(test.t3.a)->test.t3.a", "│ │ └─IndexReader 3.00 root index:StreamAgg", "│ │ └─StreamAgg 3.00 cop[tikv] group by:test.t3.a, ", @@ -7726,7 +7726,7 @@ "SQL": "select /*+ leading(t1) */ t1.a, (select min(t2.a) from t2) from t1 join t3 on t1.a = t3.a;", "Plan": [ "Projection 3.75 root test.t1.a, ->Column#14", - "└─IndexJoin 3.75 root inner join, inner:IndexReader, outer key:test.t3.a, inner key:test.t1.a, equal cond:eq(test.t3.a, test.t1.a)", + "└─IndexHashJoin 3.75 root inner join, inner:IndexReader, outer key:test.t3.a, inner key:test.t1.a, equal cond:eq(test.t3.a, test.t1.a)", " ├─IndexReader(Build) 3.00 root index:IndexFullScan", " │ └─IndexFullScan 3.00 cop[tikv] table:t3, index:a(a) keep order:false", " └─IndexReader(Probe) 3.75 root index:Selection", @@ -7739,7 +7739,7 @@ "SQL": "select /*+ leading(t1, t2@sel_2) */ t1.a, (select min(t2.a) from t2) from t1 join t3 on t1.a = t3.a;", "Plan": [ "Projection 3.75 root test.t1.a, ->Column#14", - "└─IndexJoin 3.75 root inner join, inner:IndexReader, outer key:test.t3.a, inner key:test.t1.a, equal cond:eq(test.t3.a, test.t1.a)", + "└─IndexHashJoin 3.75 root inner join, inner:IndexReader, outer key:test.t3.a, inner key:test.t1.a, equal cond:eq(test.t3.a, test.t1.a)", " ├─IndexReader(Build) 3.00 root index:IndexFullScan", " │ └─IndexFullScan 3.00 cop[tikv] table:t3, index:a(a) keep order:false", " └─IndexReader(Probe) 3.75 root index:Selection", @@ -7755,7 +7755,7 @@ "SQL": "select /*+ leading(t1, t3) */ t1.a, (select min(t2.a) from t2) from t1 join t3 on t1.a = t3.a;", "Plan": [ "Projection 3.75 root test.t1.a, ->Column#14", - "└─IndexJoin 3.75 root inner join, inner:IndexReader, outer key:test.t3.a, inner key:test.t1.a, equal cond:eq(test.t3.a, test.t1.a)", + "└─IndexHashJoin 3.75 root inner join, inner:IndexReader, outer key:test.t3.a, inner key:test.t1.a, equal cond:eq(test.t3.a, test.t1.a)", " ├─IndexReader(Build) 3.00 root index:IndexFullScan", " │ └─IndexFullScan 3.00 cop[tikv] table:t3, index:a(a) keep order:false", " └─IndexReader(Probe) 3.75 root index:Selection", @@ -7768,7 +7768,7 @@ "SQL": "select /*+ leading(t2@sel_2, t1) */ t1.a, (select min(t2.a) from t2) from t1 join t3 on t1.a = t3.a;", "Plan": [ "Projection 3.75 root test.t1.a, ->Column#14", - "└─IndexJoin 3.75 root inner join, inner:IndexReader, outer key:test.t3.a, inner key:test.t1.a, equal cond:eq(test.t3.a, test.t1.a)", + "└─IndexHashJoin 3.75 root inner join, inner:IndexReader, outer key:test.t3.a, inner key:test.t1.a, equal cond:eq(test.t3.a, test.t1.a)", " ├─IndexReader(Build) 3.00 root index:IndexFullScan", " │ └─IndexFullScan 3.00 cop[tikv] table:t3, index:a(a) keep order:false", " └─IndexReader(Probe) 3.75 root index:Selection", @@ -7784,7 +7784,7 @@ "SQL": "select /*+ leading(t2@sel_2, t3) */ t1.a, (select min(t2.a) from t2) from t1 join t3 on t1.a = t3.a;", "Plan": [ "Projection 3.75 root test.t1.a, ->Column#14", - "└─IndexJoin 3.75 root inner join, inner:IndexReader, outer key:test.t3.a, inner key:test.t1.a, equal cond:eq(test.t3.a, test.t1.a)", + "└─IndexHashJoin 3.75 root inner join, inner:IndexReader, outer key:test.t3.a, inner key:test.t1.a, equal cond:eq(test.t3.a, test.t1.a)", " ├─IndexReader(Build) 3.00 root index:IndexFullScan", " │ └─IndexFullScan 3.00 cop[tikv] table:t3, index:a(a) keep order:false", " └─IndexReader(Probe) 3.75 root index:Selection", @@ -7800,7 +7800,7 @@ "SQL": "select /*+ leading(t1, t2@sel_2) */ t1.a, (select min(t2.a) from t2) from t1 join t3 on t1.a = t3.a;", "Plan": [ "Projection 3.75 root test.t1.a, ->Column#14", - "└─IndexJoin 3.75 root inner join, inner:IndexReader, outer key:test.t3.a, inner key:test.t1.a, equal cond:eq(test.t3.a, test.t1.a)", + "└─IndexHashJoin 3.75 root inner join, inner:IndexReader, outer key:test.t3.a, inner key:test.t1.a, equal cond:eq(test.t3.a, test.t1.a)", " ├─IndexReader(Build) 3.00 root index:IndexFullScan", " │ └─IndexFullScan 3.00 cop[tikv] table:t3, index:a(a) keep order:false", " └─IndexReader(Probe) 3.75 root index:Selection", @@ -7816,7 +7816,7 @@ "SQL": "select /*+ leading(t3, t2@sel_2) */ t1.a, (select min(t2.a) from t2) from t1 join t3 on t1.a = t3.a;", "Plan": [ "Projection 3.75 root test.t1.a, ->Column#14", - "└─IndexJoin 3.75 root inner join, inner:IndexReader, outer key:test.t3.a, inner key:test.t1.a, equal cond:eq(test.t3.a, test.t1.a)", + "└─IndexHashJoin 3.75 root inner join, inner:IndexReader, outer key:test.t3.a, inner key:test.t1.a, equal cond:eq(test.t3.a, test.t1.a)", " ├─IndexReader(Build) 3.00 root index:IndexFullScan", " │ └─IndexFullScan 3.00 cop[tikv] table:t3, index:a(a) keep order:false", " └─IndexReader(Probe) 3.75 root index:Selection", diff --git a/planner/core/testdata/partition_pruner_out.json b/planner/core/testdata/partition_pruner_out.json index 7b454564bece9..3206c3dc5853d 100644 --- a/planner/core/testdata/partition_pruner_out.json +++ b/planner/core/testdata/partition_pruner_out.json @@ -1646,7 +1646,7 @@ ], "IndexPlan": [ "Sort 199.80 root test_partition_1.t1.a", - "└─IndexJoin 199.80 root inner join, inner:IndexReader, outer key:test_partition_1.t2.b, inner key:test_partition_1.t1.a, equal cond:eq(test_partition_1.t2.b, test_partition_1.t1.a)", + "└─IndexHashJoin 199.80 root inner join, inner:IndexReader, outer key:test_partition_1.t2.b, inner key:test_partition_1.t1.a, equal cond:eq(test_partition_1.t2.b, test_partition_1.t1.a)", " ├─HashAgg(Build) 159.84 root group by:test_partition_1.t2.b, funcs:firstrow(test_partition_1.t2.b)->test_partition_1.t2.b", " │ └─IndexReader 159.84 root partition:p0 index:HashAgg", " │ └─HashAgg 159.84 cop[tikv] group by:test_partition_1.t2.b, ", @@ -1676,7 +1676,7 @@ ], "IndexPlan": [ "Sort 199.80 root test_partition_1.t1.a", - "└─IndexJoin 199.80 root inner join, inner:IndexReader, outer key:test_partition_1.t1.b, inner key:test_partition_1.t1.a, equal cond:eq(test_partition_1.t1.b, test_partition_1.t1.a)", + "└─IndexHashJoin 199.80 root inner join, inner:IndexReader, outer key:test_partition_1.t1.b, inner key:test_partition_1.t1.a, equal cond:eq(test_partition_1.t1.b, test_partition_1.t1.a)", " ├─HashAgg(Build) 159.84 root group by:test_partition_1.t1.b, funcs:firstrow(test_partition_1.t1.b)->test_partition_1.t1.b", " │ └─IndexReader 159.84 root partition:p0 index:HashAgg", " │ └─HashAgg 159.84 cop[tikv] group by:test_partition_1.t1.b, ", @@ -2664,7 +2664,7 @@ ], "IndexPlan": [ "Sort 249.75 root test_partition_1.t1.a", - "└─IndexJoin 249.75 root inner join, inner:IndexReader, outer key:test_partition_1.t2.b, inner key:test_partition_1.t1.a, equal cond:eq(test_partition_1.t2.b, test_partition_1.t1.a)", + "└─IndexHashJoin 249.75 root inner join, inner:IndexReader, outer key:test_partition_1.t2.b, inner key:test_partition_1.t1.a, equal cond:eq(test_partition_1.t2.b, test_partition_1.t1.a)", " ├─HashAgg(Build) 199.80 root group by:test_partition_1.t2.b, funcs:firstrow(test_partition_1.t2.b)->test_partition_1.t2.b", " │ └─IndexReader 199.80 root partition:p0 index:HashAgg", " │ └─HashAgg 199.80 cop[tikv] group by:test_partition_1.t2.b, ", @@ -2695,7 +2695,7 @@ ], "IndexPlan": [ "Sort 249.75 root test_partition_1.t1.a", - "└─IndexJoin 249.75 root inner join, inner:IndexReader, outer key:test_partition_1.t1.b, inner key:test_partition_1.t1.a, equal cond:eq(test_partition_1.t1.b, test_partition_1.t1.a)", + "└─IndexHashJoin 249.75 root inner join, inner:IndexReader, outer key:test_partition_1.t1.b, inner key:test_partition_1.t1.a, equal cond:eq(test_partition_1.t1.b, test_partition_1.t1.a)", " ├─HashAgg(Build) 199.80 root group by:test_partition_1.t1.b, funcs:firstrow(test_partition_1.t1.b)->test_partition_1.t1.b", " │ └─IndexReader 199.80 root partition:p0 index:HashAgg", " │ └─HashAgg 199.80 cop[tikv] group by:test_partition_1.t1.b, ", diff --git a/planner/core/testdata/plan_suite_out.json b/planner/core/testdata/plan_suite_out.json index a58d243b30033..040b149e4f180 100644 --- a/planner/core/testdata/plan_suite_out.json +++ b/planner/core/testdata/plan_suite_out.json @@ -1588,7 +1588,7 @@ "Cases": [ { "SQL": "select t1.a, (select count(t2.a) from t t2 where t2.g in (select t3.d from t t3 where t3.c = t1.a)) as agg_col from t t1;", - "Best": "Apply{IndexReader(Index(t.f)[[NULL,+inf]])->IndexJoin{IndexReader(Index(t.c_d_e)[[NULL,+inf]]->HashAgg)->HashAgg->IndexReader(Index(t.g)[[NULL,NULL]])}(test.t.d,test.t.g)}->HashAgg" + "Best": "Apply{IndexReader(Index(t.f)[[NULL,+inf]])->IndexHashJoin{IndexReader(Index(t.c_d_e)[[NULL,+inf]]->HashAgg)->HashAgg->IndexReader(Index(t.g)[[NULL,NULL]])}(test.t.d,test.t.g)}->HashAgg" } ] }, @@ -6236,7 +6236,7 @@ " └─MaxOneRow(Probe) 250.00 root ", " └─HashAgg 250.00 root funcs:sum(Column#33)->Column#18", " └─Projection 1998.00 root cast(test.tb.code, decimal(10,0) BINARY)->Column#33", - " └─IndexJoin 1998.00 root semi join, inner:IndexLookUp, outer key:test.tb.name, inner key:test.tc.name, equal cond:eq(test.tb.name, test.tc.name)", + " └─IndexHashJoin 1998.00 root semi join, inner:IndexLookUp, outer key:test.tb.name, inner key:test.tc.name, equal cond:eq(test.tb.name, test.tc.name)", " ├─IndexLookUp(Build) 2497.50 root ", " │ ├─IndexRangeScan(Build) 2500.00 cop[tikv] table:tb, index:idx_tb_id(id) range: decided by [eq(test.ta.id, test.tb.id)], keep order:false, stats:pseudo", " │ └─Selection(Probe) 2497.50 cop[tikv] not(isnull(test.tb.name))", @@ -6368,7 +6368,7 @@ "Projection 249.75 root test.ta.name", "└─Apply 249.75 root CARTESIAN inner join", " ├─Apply(Build) 249.75 root CARTESIAN inner join", - " │ ├─IndexJoin(Build) 249.75 root inner join, inner:IndexLookUp, outer key:test.tb.code, inner key:test.ta.code, equal cond:eq(test.tb.code, test.ta.code)", + " │ ├─IndexHashJoin(Build) 249.75 root inner join, inner:IndexLookUp, outer key:test.tb.code, inner key:test.ta.code, equal cond:eq(test.tb.code, test.ta.code)", " │ │ ├─HashAgg(Build) 199.80 root group by:test.tb.code, funcs:firstrow(test.tb.code)->test.tb.code", " │ │ │ └─TableReader 249.75 root data:Selection", " │ │ │ └─Selection 249.75 cop[tikv] like(test.tb.name, \"chad9%\", 92), not(isnull(test.tb.code))",