From 2b3a37e927ad9f440e6e03270408e833228ee6d6 Mon Sep 17 00:00:00 2001 From: qw4990 Date: Thu, 10 Nov 2022 11:29:11 +0800 Subject: [PATCH 01/17] fixup --- bindinfo/bind_test.go | 2 + executor/explain_test.go | 4 +- executor/explainfor_test.go | 9 +- executor/partition_table_test.go | 30 +- planner/core/binary_plan_test.go | 1 + planner/core/cbo_test.go | 1 + planner/core/integration_test.go | 12 +- planner/core/partition_pruner_test.go | 19 +- planner/core/physical_plan_test.go | 6 + planner/core/plan_cost_ver1.go | 7 +- planner/core/plan_cost_ver2.go | 3 +- planner/core/rule_join_reorder_test.go | 1 + planner/core/testdata/analyze_suite_out.json | 8 +- .../core/testdata/binary_plan_suite_out.json | 62 +- .../core/testdata/integration_suite_out.json | 20 +- .../core/testdata/join_reorder_suite_out.json | 1064 ++++++++--------- planner/core/testdata/plan_suite_out.json | 57 +- statistics/integration_test.go | 1 + .../testdata/integration_suite_out.json | 22 +- util/ranger/ranger_test.go | 1 + util/ranger/testdata/ranger_suite_out.json | 4 +- 21 files changed, 677 insertions(+), 657 deletions(-) diff --git a/bindinfo/bind_test.go b/bindinfo/bind_test.go index f71d13d08f420..5c48869acd69e 100644 --- a/bindinfo/bind_test.go +++ b/bindinfo/bind_test.go @@ -874,6 +874,7 @@ func TestNotEvolvePlanForReadStorageHint(t *testing.T) { tk := testkit.NewTestKit(t, store) tk.MustExec("use test") + tk.MustExec("set tidb_cost_model_version=2") tk.MustExec("drop table if exists t") tk.MustExec("create table t(a int, b int, index idx_a(a), index idx_b(b))") tk.MustExec("insert into t values (1,1), (2,2), (3,3), (4,4), (5,5), (6,6), (7,7), (8,8), (9,9), (10,10)") @@ -918,6 +919,7 @@ func TestBindingWithIsolationRead(t *testing.T) { tk := testkit.NewTestKit(t, store) tk.MustExec("use test") + tk.MustExec("set tidb_cost_model_version=2") tk.MustExec("drop table if exists t") tk.MustExec("create table t(a int, b int, index idx_a(a), index idx_b(b))") tk.MustExec("insert into t values (1,1), (2,2), (3,3), (4,4), (5,5), (6,6), (7,7), (8,8), (9,9), (10,10)") diff --git a/executor/explain_test.go b/executor/explain_test.go index 4899f8a354403..8742b9ee011da 100644 --- a/executor/explain_test.go +++ b/executor/explain_test.go @@ -321,6 +321,7 @@ func TestCheckActRowsWithUnistore(t *testing.T) { // testSuite1 use default mockstore which is unistore tk := testkit.NewTestKit(t, store) tk.MustExec("use test") + tk.MustExec("set tidb_cost_model_version=2") tk.MustExec("drop table if exists t_unistore_act_rows") tk.MustExec("create table t_unistore_act_rows(a int, b int, index(a, b))") tk.MustExec("insert into t_unistore_act_rows values (1, 0), (1, 0), (2, 0), (2, 1)") @@ -363,7 +364,7 @@ func TestCheckActRowsWithUnistore(t *testing.T) { }, { sql: "select count(*) from t_unistore_act_rows group by b", - expected: []string{"2", "2", "2", "4"}, + expected: []string{"2", "4", "4"}, }, { sql: "with cte(a) as (select a from t_unistore_act_rows) select (select 1 from cte limit 1) from cte;", @@ -383,6 +384,7 @@ func TestCheckActRowsWithUnistore(t *testing.T) { tk.MustExec("set @@tidb_enable_chunk_rpc = on") for _, test := range tests { + fmt.Println(">>> ", test.sql) checkActRows(t, tk, test.sql, test.expected) } } diff --git a/executor/explainfor_test.go b/executor/explainfor_test.go index db80c89f8d26e..85652a5f04ddb 100644 --- a/executor/explainfor_test.go +++ b/executor/explainfor_test.go @@ -980,6 +980,7 @@ func TestSetOperations4PlanCache(t *testing.T) { func TestSPM4PlanCache(t *testing.T) { store := testkit.CreateMockStore(t) tk := testkit.NewTestKit(t, store) + tk.MustExec("set tidb_cost_model_version=2") tk.MustExec(`set tidb_enable_prepared_plan_cache=1`) tk.MustExec("use test") @@ -990,8 +991,8 @@ func TestSPM4PlanCache(t *testing.T) { tk.MustExec("admin reload bindings;") res := tk.MustQuery("explain format = 'brief' select * from t;") - require.Regexp(t, ".*TableReader.*", res.Rows()[0][0]) - require.Regexp(t, ".*TableFullScan.*", res.Rows()[1][0]) + require.Regexp(t, ".*IndexReader.*", res.Rows()[0][0]) + require.Regexp(t, ".*IndexFullScan.*", res.Rows()[1][0]) tk.MustExec("prepare stmt from 'select * from t;';") tk.MustQuery("execute stmt;").Check(testkit.Rows()) @@ -1000,8 +1001,8 @@ func TestSPM4PlanCache(t *testing.T) { ps := []*util.ProcessInfo{tkProcess} tk.Session().SetSessionManager(&testkit.MockSessionManager{PS: ps}) res = tk.MustQuery("explain for connection " + strconv.FormatUint(tkProcess.ID, 10)) - require.Regexp(t, ".*TableReader.*", res.Rows()[0][0]) - require.Regexp(t, ".*TableFullScan.*", res.Rows()[1][0]) + require.Regexp(t, ".*IndexReader.*", res.Rows()[0][0]) + require.Regexp(t, ".*IndexFullScan.*", res.Rows()[1][0]) tk.MustExec("create global binding for select * from t using select * from t use index(idx_a);") diff --git a/executor/partition_table_test.go b/executor/partition_table_test.go index 3640b4e155097..39ac194311588 100644 --- a/executor/partition_table_test.go +++ b/executor/partition_table_test.go @@ -910,6 +910,7 @@ func TestGlobalStatsAndSQLBinding(t *testing.T) { tk.MustExec("create database test_global_stats") tk.MustExec("use test_global_stats") tk.MustExec("set @@tidb_partition_prune_mode = 'dynamic'") + tk.MustExec("set tidb_cost_model_version=2") // hash and range and list partition tk.MustExec("create table thash(a int, b int, key(a)) partition by hash(a) partitions 4") @@ -953,10 +954,9 @@ func TestGlobalStatsAndSQLBinding(t *testing.T) { tk.MustExec("analyze table trange") tk.MustExec("analyze table tlist") - // after analyzing, the planner will use the Index(a) - tk.MustIndexLookup("select * from thash where a<100") - tk.MustIndexLookup("select * from trange where a<100") - tk.MustIndexLookup("select * from tlist where a<1") + require.True(t, tk.HasPlan("select * from thash where a<100", "TableFullScan")) + require.True(t, tk.HasPlan("select * from trange where a<100", "TableFullScan")) + require.True(t, tk.HasPlan("select * from tlist where a<1", "TableFullScan")) // create SQL bindings tk.MustExec("create session binding for select * from thash where a<100 using select * from thash ignore index(a) where a<100") @@ -973,10 +973,9 @@ func TestGlobalStatsAndSQLBinding(t *testing.T) { tk.MustExec("drop session binding for select * from trange where a<100") tk.MustExec("drop session binding for select * from tlist where a<100") - // use Index(a) again - tk.MustIndexLookup("select * from thash where a<100") - tk.MustIndexLookup("select * from trange where a<100") - tk.MustIndexLookup("select * from tlist where a<1") + require.True(t, tk.HasPlan("select * from thash where a<100", "TableFullScan")) + require.True(t, tk.HasPlan("select * from trange where a<100", "TableFullScan")) + require.True(t, tk.HasPlan("select * from tlist where a<1", "TableFullScan")) } func TestPartitionTableWithDifferentJoin(t *testing.T) { @@ -3435,6 +3434,7 @@ func TestPartitionTableExplain(t *testing.T) { tk := testkit.NewTestKit(t, store) tk.MustExec("create database TestPartitionTableExplain") + tk.MustExec("set tidb_cost_model_version=2") tk.MustExec("use TestPartitionTableExplain") tk.MustExec("set @@tidb_partition_prune_mode = 'static'") tk.MustExec(`create table t (a int primary key, b int, key (b)) partition by hash(a) (partition P0, partition p1, partition P2)`) @@ -3571,22 +3571,20 @@ func TestPartitionTableExplain(t *testing.T) { "└─IndexRangeScan 2.00 cop[tikv] table:t, index:b(b) range:[2,2], [3,3], keep order:false")) tk.MustQuery(`explain format = 'brief' select * from t,t2 where t2.a = 1 and t2.b = t.b`).Check(testkit.Rows( "Projection 1.00 root testpartitiontableexplain.t.a, testpartitiontableexplain.t.b, testpartitiontableexplain.t2.a, testpartitiontableexplain.t2.b", - "└─IndexJoin 1.00 root inner join, inner:IndexReader, outer key:testpartitiontableexplain.t2.b, inner key:testpartitiontableexplain.t.b, equal cond:eq(testpartitiontableexplain.t2.b, testpartitiontableexplain.t.b)", + "└─HashJoin 1.00 root inner join, equal:[eq(testpartitiontableexplain.t2.b, testpartitiontableexplain.t.b)]", " ├─TableReader(Build) 1.00 root data:Selection", " │ └─Selection 1.00 cop[tikv] eq(testpartitiontableexplain.t2.a, 1), not(isnull(testpartitiontableexplain.t2.b))", " │ └─TableFullScan 3.00 cop[tikv] table:t2 keep order:false", - " └─IndexReader(Probe) 1.00 root partition:all index:Selection", - " └─Selection 1.00 cop[tikv] not(isnull(testpartitiontableexplain.t.b))", - " └─IndexRangeScan 1.00 cop[tikv] table:t, index:b(b) range: decided by [eq(testpartitiontableexplain.t.b, testpartitiontableexplain.t2.b)], keep order:false")) + " └─IndexReader(Probe) 3.00 root partition:all index:IndexFullScan", + " └─IndexFullScan 3.00 cop[tikv] table:t, index:b(b) keep order:false")) tk.MustQuery(`explain format = 'brief' select * from t partition (p1),t2 where t2.a = 1 and t2.b = t.b`).Check(testkit.Rows( "Projection 1.00 root testpartitiontableexplain.t.a, testpartitiontableexplain.t.b, testpartitiontableexplain.t2.a, testpartitiontableexplain.t2.b", - "└─IndexJoin 1.00 root inner join, inner:IndexReader, outer key:testpartitiontableexplain.t2.b, inner key:testpartitiontableexplain.t.b, equal cond:eq(testpartitiontableexplain.t2.b, testpartitiontableexplain.t.b)", + "└─HashJoin 1.00 root inner join, equal:[eq(testpartitiontableexplain.t2.b, testpartitiontableexplain.t.b)]", " ├─TableReader(Build) 1.00 root data:Selection", " │ └─Selection 1.00 cop[tikv] eq(testpartitiontableexplain.t2.a, 1), not(isnull(testpartitiontableexplain.t2.b))", " │ └─TableFullScan 3.00 cop[tikv] table:t2 keep order:false", - " └─IndexReader(Probe) 1.00 root partition:p1 index:Selection", - " └─Selection 1.00 cop[tikv] not(isnull(testpartitiontableexplain.t.b))", - " └─IndexRangeScan 1.00 cop[tikv] table:t, index:b(b) range: decided by [eq(testpartitiontableexplain.t.b, testpartitiontableexplain.t2.b)], keep order:false")) + " └─IndexReader(Probe) 3.00 root partition:p1 index:IndexFullScan", + " └─IndexFullScan 3.00 cop[tikv] table:t, index:b(b) keep order:false")) tk.MustQuery(`explain format = 'brief' select * from t,t2 where t2.a = 1 and t2.b = t.b and t.a = 1`).Check(testkit.Rows( "HashJoin 1.00 root inner join, equal:[eq(testpartitiontableexplain.t.b, testpartitiontableexplain.t2.b)]", "├─TableReader(Build) 1.00 root data:Selection", diff --git a/planner/core/binary_plan_test.go b/planner/core/binary_plan_test.go index b7c047253c6db..78022acb63166 100644 --- a/planner/core/binary_plan_test.go +++ b/planner/core/binary_plan_test.go @@ -80,6 +80,7 @@ func TestBinaryPlanInExplainAndSlowLog(t *testing.T) { store := testkit.CreateMockStore(t) tk := testkit.NewTestKit(t, store) tk.MustExec("use test") + tk.MustExec("set tidb_cost_model_version=2") // If we don't set this, it will be false sometimes and the cost in the result will be different. tk.MustExec("set @@tidb_enable_chunk_rpc=true") diff --git a/planner/core/cbo_test.go b/planner/core/cbo_test.go index 340c0e2830162..84bc3b477165d 100644 --- a/planner/core/cbo_test.go +++ b/planner/core/cbo_test.go @@ -609,6 +609,7 @@ func TestIssue9562(t *testing.T) { tk := testkit.NewTestKit(t, store) tk.MustExec("use test") + tk.MustExec("set tidb_cost_model_version=2") var input [][]string var output []struct { SQL []string diff --git a/planner/core/integration_test.go b/planner/core/integration_test.go index 9f842f2b3c85b..45e9eecb5e426 100644 --- a/planner/core/integration_test.go +++ b/planner/core/integration_test.go @@ -1937,6 +1937,7 @@ func TestIssue17813(t *testing.T) { func TestHintWithRequiredProperty(t *testing.T) { store := testkit.CreateMockStore(t) tk := testkit.NewTestKit(t, store) + tk.MustExec("set tidb_cost_model_version=2") tk.MustExec("set @@session.tidb_executor_concurrency = 4;") tk.MustExec("set @@session.tidb_hash_join_concurrency = 5;") tk.MustExec("set @@session.tidb_distsql_scan_concurrency = 15;") @@ -2683,6 +2684,7 @@ func TestIndexJoinOnClusteredIndex(t *testing.T) { store := testkit.CreateMockStore(t) tk := testkit.NewTestKit(t, store) tk.MustExec("use test") + tk.MustExec("set tidb_cost_model_version=2") tk.Session().GetSessionVars().EnableClusteredIndex = variable.ClusteredIndexDefModeOn tk.MustExec("drop table if exists t1") tk.MustExec("create table t (a int, b varchar(20), c decimal(40,10), d int, primary key(a,b), key(c))") @@ -5799,6 +5801,7 @@ func TestIssues27130(t *testing.T) { tk.MustExec("use test") tk.MustExec("drop table if exists t1") + tk.MustExec("set tidb_cost_model_version=2") tk.MustExec("create table t1( a enum('y','b','Abc','null'),b enum('y','b','Abc','null'),key(a));") tk.MustQuery(`explain format=brief select * from t1 where a like "A%"`).Check(testkit.Rows( "TableReader 8000.00 root data:Selection", @@ -5814,14 +5817,14 @@ func TestIssues27130(t *testing.T) { tk.MustExec("drop table if exists t2") tk.MustExec("create table t2( a enum('y','b','Abc','null'),b enum('y','b','Abc','null'),key(a, b));") tk.MustQuery(`explain format=brief select * from t2 where a like "A%"`).Check(testkit.Rows( - "TableReader 8000.00 root data:Selection", + "IndexReader 8000.00 root index:Selection", "└─Selection 8000.00 cop[tikv] like(test.t2.a, \"A%\", 92)", - " └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo", + " └─IndexFullScan 10000.00 cop[tikv] table:t2, index:a(a, b) keep order:false, stats:pseudo", )) tk.MustQuery(`explain format=brief select * from t2 where a like "A%" and b like "A%"`).Check(testkit.Rows( - "TableReader 8000.00 root data:Selection", + "IndexReader 8000.00 root index:Selection", "└─Selection 8000.00 cop[tikv] like(test.t2.a, \"A%\", 92), like(test.t2.b, \"A%\", 92)", - " └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo", + " └─IndexFullScan 10000.00 cop[tikv] table:t2, index:a(a, b) keep order:false, stats:pseudo", )) tk.MustExec("drop table if exists t3") @@ -6585,6 +6588,7 @@ func TestIssue31240(t *testing.T) { tk.MustExec("use test") tk.MustExec("create table t31240(a int, b int);") tk.MustExec("set @@tidb_allow_mpp = 0") + tk.MustExec("set tidb_cost_model_version=2") tbl, err := dom.InfoSchema().TableByName(model.CIStr{O: "test", L: "test"}, model.CIStr{O: "t31240", L: "t31240"}) require.NoError(t, err) diff --git a/planner/core/partition_pruner_test.go b/planner/core/partition_pruner_test.go index 75350e7d3a1ad..07dddbdb51175 100644 --- a/planner/core/partition_pruner_test.go +++ b/planner/core/partition_pruner_test.go @@ -68,6 +68,7 @@ func TestHashPartitionPruner(t *testing.T) { func TestRangeColumnPartitionPruningForIn(t *testing.T) { store := testkit.CreateMockStore(t) tk := testkit.NewTestKit(t, store) + tk.MustExec("set tidb_cost_model_version=2") tk.MustExec("drop database if exists test_range_col_in") tk.MustExec("create database test_range_col_in") tk.MustExec("use test_range_col_in") @@ -88,16 +89,14 @@ func TestRangeColumnPartitionPruningForIn(t *testing.T) { tk.MustQuery(`explain format='brief' select /*+ HASH_AGG() */ count(1) from t1 where dt in ('2020-11-27','2020-11-28')`).Check( testkit.Rows("HashAgg 1.00 root funcs:count(Column#5)->Column#4", "└─PartitionUnion 2.00 root ", - " ├─HashAgg 1.00 root funcs:count(Column#7)->Column#5", - " │ └─IndexReader 1.00 root index:HashAgg", - " │ └─HashAgg 1.00 cop[tikv] funcs:count(1)->Column#7", - " │ └─Selection 20.00 cop[tikv] in(test_range_col_in.t1.dt, 2020-11-27 00:00:00.000000, 2020-11-28 00:00:00.000000)", - " │ └─IndexFullScan 10000.00 cop[tikv] table:t1, partition:p20201127, index:PRIMARY(id, dt) keep order:false, stats:pseudo", - " └─HashAgg 1.00 root funcs:count(Column#10)->Column#5", - " └─IndexReader 1.00 root index:HashAgg", - " └─HashAgg 1.00 cop[tikv] funcs:count(1)->Column#10", - " └─Selection 20.00 cop[tikv] in(test_range_col_in.t1.dt, 2020-11-27 00:00:00.000000, 2020-11-28 00:00:00.000000)", - " └─IndexFullScan 10000.00 cop[tikv] table:t1, partition:p20201128, index:PRIMARY(id, dt) keep order:false, stats:pseudo")) + " ├─HashAgg 1.00 root funcs:count(1)->Column#5", + " │ └─IndexReader 20.00 root index:Selection", + " │ └─Selection 20.00 cop[tikv] in(test_range_col_in.t1.dt, 2020-11-27 00:00:00.000000, 2020-11-28 00:00:00.000000)", + " │ └─IndexFullScan 10000.00 cop[tikv] table:t1, partition:p20201127, index:PRIMARY(id, dt) keep order:false, stats:pseudo", + " └─HashAgg 1.00 root funcs:count(1)->Column#5", + " └─IndexReader 20.00 root index:Selection", + " └─Selection 20.00 cop[tikv] in(test_range_col_in.t1.dt, 2020-11-27 00:00:00.000000, 2020-11-28 00:00:00.000000)", + " └─IndexFullScan 10000.00 cop[tikv] table:t1, partition:p20201128, index:PRIMARY(id, dt) keep order:false, stats:pseudo")) tk.MustExec(`insert into t1 values (1, "2020-11-25")`) tk.MustExec(`insert into t1 values (2, "2020-11-26")`) diff --git a/planner/core/physical_plan_test.go b/planner/core/physical_plan_test.go index 36676cb9b1fdc..42e63e3da2e73 100644 --- a/planner/core/physical_plan_test.go +++ b/planner/core/physical_plan_test.go @@ -185,6 +185,7 @@ func TestDAGPlanBuilderJoin(t *testing.T) { tk := testkit.NewTestKit(t, store) tk.MustExec("use test") + tk.MustExec("set tidb_cost_model_version=2") sessionVars := tk.Session().GetSessionVars() sessionVars.ExecutorConcurrency = 4 sessionVars.SetDistSQLScanConcurrency(15) @@ -220,6 +221,7 @@ func TestDAGPlanBuilderSubquery(t *testing.T) { tk := testkit.NewTestKit(t, store) tk.MustExec("use test") + tk.MustExec("set tidb_cost_model_version=2") tk.MustExec("set sql_mode='STRICT_TRANS_TABLES'") // disable only full group by sessionVars := tk.Session().GetSessionVars() sessionVars.SetHashAggFinalConcurrency(1) @@ -839,6 +841,7 @@ func TestHintScope(t *testing.T) { store := testkit.CreateMockStore(t) tk := testkit.NewTestKit(t, store) tk.MustExec("use test") + tk.MustExec("set tidb_cost_model_version=2") var input []string var output []struct { @@ -1325,6 +1328,7 @@ func TestPushdownDistinctEnable(t *testing.T) { vars := []string{ fmt.Sprintf("set @@session.%s = 1", variable.TiDBOptDistinctAggPushDown), "set session tidb_opt_agg_push_down = 1", + "set tidb_cost_model_version = 2", } doTestPushdownDistinct(t, vars, input, output) } @@ -1362,6 +1366,7 @@ func TestPushdownDistinctEnableAggPushDownDisable(t *testing.T) { vars := []string{ fmt.Sprintf("set @@session.%s = 1", variable.TiDBOptDistinctAggPushDown), "set session tidb_opt_agg_push_down = 0", + "set tidb_cost_model_version=2", } doTestPushdownDistinct(t, vars, input, output) } @@ -2365,6 +2370,7 @@ func TestMPPSinglePartitionType(t *testing.T) { store, dom := testkit.CreateMockStoreAndDomain(t) tk := testkit.NewTestKit(t, store) tk.MustExec("use test") + tk.MustExec("set tidb_cost_model_version=2") tk.MustExec("drop table if exists employee") tk.MustExec("create table employee(empid int, deptid int, salary decimal(10,2))") tk.MustExec("set tidb_enforce_mpp=0") diff --git a/planner/core/plan_cost_ver1.go b/planner/core/plan_cost_ver1.go index d1a7e6e95a9c5..694639680f4f2 100644 --- a/planner/core/plan_cost_ver1.go +++ b/planner/core/plan_cost_ver1.go @@ -1272,7 +1272,12 @@ func getCardinality(operator PhysicalPlan, costFlag uint64) float64 { actualProbeCnt := operator.getActualProbeCnt(operator.SCtx().GetSessionVars().StmtCtx.RuntimeStatsColl) return getOperatorActRows(operator) / float64(actualProbeCnt) } - return operator.StatsCount() + rows := operator.StatsCount() + if rows == 0 { + // 0 est-row can lead to 0 operator cost which makes plan choice unstable. + rows = 1 + } + return rows } // estimateNetSeekCost calculates the net seek cost for the plan. diff --git a/planner/core/plan_cost_ver2.go b/planner/core/plan_cost_ver2.go index 0f4c936fa4e46..e6af4df396e0b 100644 --- a/planner/core/plan_cost_ver2.go +++ b/planner/core/plan_cost_ver2.go @@ -205,8 +205,7 @@ func (p *PhysicalTableReader) getPlanCostVer2(taskType property.TaskType, option p.planCostInit = true // consider tidb_enforce_mpp - _, isMPP := p.tablePlan.(*PhysicalExchangeSender) - if isMPP && p.ctx.GetSessionVars().IsMPPEnforced() && + if p.StoreType == kv.TiFlash && p.ctx.GetSessionVars().IsMPPEnforced() && !hasCostFlag(option.CostFlag, CostFlagRecalculate) { // show the real cost in explain-statements p.planCostVer2 = divCostVer2(p.planCostVer2, 1000000000) } diff --git a/planner/core/rule_join_reorder_test.go b/planner/core/rule_join_reorder_test.go index d4d35f5de80a4..9fb0c7e83ab1f 100644 --- a/planner/core/rule_join_reorder_test.go +++ b/planner/core/rule_join_reorder_test.go @@ -221,6 +221,7 @@ func TestJoinOrderHint4StaticPartitionTable(t *testing.T) { tk := testkit.NewTestKit(t, store) tk.MustExec("use test") + tk.MustExec("set tidb_cost_model_version=2") tk.MustExec("drop table if exists t, t1, t2, t3;") tk.MustExec(`create table t(a int, b int) partition by hash(a) partitions 3`) tk.MustExec(`create table t1(a int, b int) partition by hash(a) partitions 4`) diff --git a/planner/core/testdata/analyze_suite_out.json b/planner/core/testdata/analyze_suite_out.json index 38fc33be76916..496cc869b9746 100644 --- a/planner/core/testdata/analyze_suite_out.json +++ b/planner/core/testdata/analyze_suite_out.json @@ -271,12 +271,12 @@ "Plan": [ "Projection 0.00 root test.t.a, test.t.b, test.t.a, test.t.b", "└─HashJoin 0.00 root inner join, equal:[eq(test.t.b, test.t.b)]", - " ├─TableReader(Build) 0.00 root data:Selection", + " ├─IndexReader(Build) 0.00 root index:Selection", " │ └─Selection 0.00 cop[tikv] isnull(test.t.b), not(isnull(test.t.b))", - " │ └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo", - " └─TableReader(Probe) 9990.00 root data:Selection", + " │ └─IndexFullScan 10000.00 cop[tikv] table:t2, index:idx_ab(a, b) keep order:false, stats:pseudo", + " └─IndexReader(Probe) 9990.00 root index:Selection", " └─Selection 9990.00 cop[tikv] not(isnull(test.t.b))", - " └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo" + " └─IndexFullScan 10000.00 cop[tikv] table:t1, index:idx_ab(a, b) keep order:false, stats:pseudo" ] } ] diff --git a/planner/core/testdata/binary_plan_suite_out.json b/planner/core/testdata/binary_plan_suite_out.json index 3c702871c50ff..203f11acf364f 100644 --- a/planner/core/testdata/binary_plan_suite_out.json +++ b/planner/core/testdata/binary_plan_suite_out.json @@ -46,7 +46,7 @@ "children": [ { "name": "TableFullScan_4", - "cost": 570000, + "cost": 2273079.737793511, "est_rows": 10000, "act_rows": 2, "task_type": 2, @@ -54,7 +54,7 @@ "operator_info": "keep order:false, stats:pseudo" } ], - "cost": 48834.666666666664, + "cost": 236018.64918623405, "est_rows": 10000, "act_rows": 2, "task_type": 1, @@ -81,7 +81,7 @@ "children": [ { "name": "IndexFullScan_14", - "cost": 435000, + "cost": 1628000, "est_rows": 10000, "act_rows": 2, "task_type": 2, @@ -92,7 +92,7 @@ "labels": [ 2 ], - "cost": 34418, + "cost": 150773.33333333334, "est_rows": 10000, "act_rows": 2, "task_type": 1, @@ -104,7 +104,7 @@ "children": [ { "name": "TableFullScan_16", - "cost": 570000, + "cost": 2273079.737793511, "est_rows": 10000, "act_rows": 4, "task_type": 2, @@ -115,7 +115,7 @@ "labels": [ 1 ], - "cost": 43418, + "cost": 193778.64918623405, "est_rows": 10000, "act_rows": 4, "task_type": 1, @@ -123,7 +123,7 @@ "operator_info": "data:TableFullScan_16" } ], - "cost": 60107864, + "cost": 975351.9825195674, "est_rows": 100000000, "act_rows": 8, "task_type": 1, @@ -131,7 +131,7 @@ "operator_info": "CARTESIAN inner join" } ], - "cost": 120107882, + "cost": 998975351.9825196, "est_rows": 100000000, "act_rows": 8, "task_type": 1, @@ -139,7 +139,7 @@ "operator_info": "cast(test.t.a, decimal(10,0) BINARY)->Column#8" } ], - "cost": 120107897.001, + "cost": 1996975363.5625196, "est_rows": 1, "act_rows": 1, "task_type": 1, @@ -157,14 +157,14 @@ "children": [ { "name": "IndexRangeScan_5", - "cost": 145000, + "cost": 542666.6666666667, "est_rows": 3333.3333333333335, "task_type": 2, "store_type": 2, "operator_info": "range:(100,+inf], keep order:false, stats:pseudo" } ], - "cost": 11473.555555555557, + "cost": 50257.77777777778, "est_rows": 3333.3333333333335, "task_type": 1, "store_type": 1, @@ -184,7 +184,7 @@ "children": [ { "name": "TableFullScan_5", - "cost": 570000, + "cost": 2273079.737793511, "est_rows": 10000, "act_rows": 2, "task_type": 2, @@ -192,14 +192,14 @@ "operator_info": "keep order:false, stats:pseudo" } ], - "cost": 600000, + "cost": 2772079.737793511, "est_rows": 3333.3333333333335, "task_type": 2, "store_type": 2, "operator_info": "gt(test.t.a, 100)" } ], - "cost": 41806.88888888889, + "cost": 198885.3158529007, "est_rows": 3333.3333333333335, "task_type": 1, "store_type": 1, @@ -222,7 +222,7 @@ "children": [ { "name": "TableFullScan_35", - "cost": 570000, + "cost": 2273079.737793511, "est_rows": 10000, "act_rows": 2, "task_type": 2, @@ -230,7 +230,7 @@ "operator_info": "keep order:false, stats:pseudo" } ], - "cost": 600000, + "cost": 2772079.737793511, "est_rows": 9990, "act_rows": 2, "task_type": 2, @@ -241,7 +241,7 @@ "labels": [ 2 ], - "cost": 50823.833333333336, + "cost": 269200.8358529007, "est_rows": 9990, "act_rows": 2, "task_type": 1, @@ -256,7 +256,7 @@ "children": [ { "name": "TableFullScan_32", - "cost": 570000, + "cost": 2273079.737793511, "est_rows": 10000, "act_rows": 4, "task_type": 2, @@ -264,7 +264,7 @@ "operator_info": "keep order:false, stats:pseudo" } ], - "cost": 600000, + "cost": 2772079.737793511, "est_rows": 9990, "act_rows": 4, "task_type": 2, @@ -275,7 +275,7 @@ "labels": [ 1 ], - "cost": 50823.833333333336, + "cost": 269200.8358529007, "est_rows": 9990, "act_rows": 4, "task_type": 1, @@ -283,7 +283,7 @@ "operator_info": "data:Selection_33" } ], - "cost": 139138.15666666668, + "cost": 1798740.0717058014, "est_rows": 12487.5, "task_type": 1, "store_type": 1, @@ -322,7 +322,7 @@ "labels": [ 3 ], - "cost": 18.6, + "cost": 0.0998, "est_rows": 1, "act_rows": 1, "task_type": 1, @@ -344,7 +344,7 @@ "operator_info": "Scan on CTE_0" } ], - "cost": 3, + "cost": 49.9, "est_rows": 0.8, "act_rows": 4, "task_type": 1, @@ -355,7 +355,7 @@ "labels": [ 4 ], - "cost": 21.48, + "cost": 57.884, "est_rows": 0.8, "act_rows": 4, "task_type": 1, @@ -387,7 +387,7 @@ "children": [ { "name": "TableFullScan_6", - "cost": 570000, + "cost": 2273079.737793511, "est_rows": 10000, "act_rows": 4, "task_type": 2, @@ -395,14 +395,14 @@ "operator_info": "keep order:false, stats:pseudo" } ], - "cost": 600000, + "cost": 2772079.737793511, "est_rows": 3333.3333333333335, "task_type": 2, "store_type": 2, "operator_info": "gt(test.t2.b, 10)" } ], - "cost": 45418, + "cost": 227045.3158529007, "est_rows": 3333.3333333333335, "task_type": 1, "store_type": 1, @@ -439,7 +439,7 @@ "children": [ { "name": "TableFullScan_6", - "cost": 570000, + "cost": 2273079.737793511, "est_rows": 10000, "act_rows": 2, "task_type": 2, @@ -447,7 +447,7 @@ "operator_info": "keep order:false, stats:pseudo" } ], - "cost": 48834.666666666664, + "cost": 236018.64918623405, "est_rows": 10000, "act_rows": 2, "task_type": 1, @@ -473,7 +473,7 @@ "children": [ { "name": "TableFullScan_5", - "cost": 570000, + "cost": 2273079.737793511, "est_rows": 10000, "act_rows": 8, "task_type": 2, @@ -481,7 +481,7 @@ "operator_info": "keep order:false, stats:pseudo" } ], - "cost": 54251.333333333336, + "cost": 278258.64918623405, "est_rows": 10000, "act_rows": 8, "task_type": 1, diff --git a/planner/core/testdata/integration_suite_out.json b/planner/core/testdata/integration_suite_out.json index 304d84c59486a..538b1e95c5af6 100644 --- a/planner/core/testdata/integration_suite_out.json +++ b/planner/core/testdata/integration_suite_out.json @@ -532,11 +532,11 @@ "SQL": "desc format = 'brief' select /*+ INL_MERGE_JOIN(t2)*/ t1.a, t2.a from t t1, t t2 ,t t3 where t1.a = t2.a and t3.a=t2.a", "Plan": [ "HashJoin 15625.00 root inner join, equal:[eq(test.t.a, test.t.a)]", - "├─TableReader(Build) 10000.00 root data:TableFullScan", - "│ └─TableFullScan 10000.00 cop[tikv] table:t3 keep order:false, stats:pseudo", + "├─IndexReader(Build) 10000.00 root index:IndexFullScan", + "│ └─IndexFullScan 10000.00 cop[tikv] table:t3, index:b(b) keep order:false, stats:pseudo", "└─IndexMergeJoin(Probe) 12500.00 root inner join, inner:TableReader, outer key:test.t.a, inner key:test.t.a", - " ├─TableReader(Build) 10000.00 root data:TableFullScan", - " │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + " ├─IndexReader(Build) 10000.00 root index:IndexFullScan", + " │ └─IndexFullScan 10000.00 cop[tikv] table:t1, index:b(b) keep order:false, stats:pseudo", " └─TableReader(Probe) 10000.00 root data:TableRangeScan", " └─TableRangeScan 10000.00 cop[tikv] table:t2 range: decided by [test.t.a], keep order:true, stats:pseudo" ], @@ -562,8 +562,8 @@ "SQL": "desc format = 'brief' select /*+ INL_HASH_JOIN(t2) */ distinct t2.a from t t1 join t t2 on t1.a = t2.a", "Plan": [ "IndexHashJoin 12500.00 root inner join, inner:TableReader, outer key:test.t.a, inner key:test.t.a, equal cond:eq(test.t.a, test.t.a)", - "├─TableReader(Build) 10000.00 root data:TableFullScan", - "│ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + "├─IndexReader(Build) 10000.00 root index:IndexFullScan", + "│ └─IndexFullScan 10000.00 cop[tikv] table:t1, index:b(b) keep order:false, stats:pseudo", "└─TableReader(Probe) 10000.00 root data:TableRangeScan", " └─TableRangeScan 10000.00 cop[tikv] table:t2 range: decided by [test.t.a], keep order:false, stats:pseudo" ], @@ -1206,8 +1206,8 @@ "Plan": [ "IndexMergeJoin 3.00 root left outer join, inner:Projection, outer key:Column#9, inner key:test.t.c", "├─Projection(Build) 3.00 root cast(test.t.a, decimal(10,0) BINARY)->Column#9", - "│ └─TableReader 3.00 root data:TableFullScan", - "│ └─TableFullScan 3.00 cop[tikv] table:t1 keep order:false", + "│ └─IndexReader 3.00 root index:IndexFullScan", + "│ └─IndexFullScan 3.00 cop[tikv] table:t1, index:c(c) keep order:false", "└─Projection(Probe) 3.00 root test.t.a, test.t.c, test.t.d", " └─IndexLookUp 3.00 root ", " ├─IndexRangeScan(Build) 3.00 cop[tikv] table:t2, index:c(c) range: decided by [eq(test.t.c, Column#9)], keep order:true", @@ -2415,8 +2415,8 @@ "Plan": [ "StreamAgg 1.00 root funcs:count(Column#6)->Column#4", "└─TableReader 1.00 root data:StreamAgg", - " └─StreamAgg 1.00 batchCop[tiflash] funcs:count(1)->Column#6", - " └─TableFullScan 10000.00 batchCop[tiflash] table:t31240 keep order:false, stats:pseudo" + " └─StreamAgg 1.00 cop[tikv] funcs:count(1)->Column#6", + " └─TableFullScan 10000.00 cop[tikv] table:t31240 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 e17cbae1f3b3d..5581a7a690ae0 100644 --- a/planner/core/testdata/join_reorder_suite_out.json +++ b/planner/core/testdata/join_reorder_suite_out.json @@ -2533,60 +2533,60 @@ " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t3.b))", " │ └─TableFullScan 10000.00 cop[tikv] table:t3, partition:p2 keep order:false, stats:pseudo", " └─HashJoin(Probe) 58476.62 root inner join, equal:[eq(test.t.b, test.t2.b)]", - " ├─HashJoin(Build) 46781.30 root left outer join, equal:[eq(test.t.a, test.t1.a)]", - " │ ├─PartitionUnion(Build) 39960.00 root ", - " │ │ ├─TableReader 9990.00 root data:Selection", - " │ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.a))", - " │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1, partition:p0 keep order:false, stats:pseudo", - " │ │ ├─TableReader 9990.00 root data:Selection", - " │ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.a))", - " │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1, partition:p1 keep order:false, stats:pseudo", - " │ │ ├─TableReader 9990.00 root data:Selection", - " │ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.a))", - " │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1, partition:p2 keep order:false, stats:pseudo", - " │ │ └─TableReader 9990.00 root data:Selection", - " │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.a))", - " │ │ └─TableFullScan 10000.00 cop[tikv] table:t1, partition:p3 keep order:false, stats:pseudo", - " │ └─HashJoin(Probe) 37425.04 root inner join, equal:[eq(test.t.a, test.t4.a)]", - " │ ├─PartitionUnion(Build) 29940.03 root ", - " │ │ ├─TableReader 9980.01 root data:Selection", - " │ │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t.a)), not(isnull(test.t.b))", - " │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t, partition:p0 keep order:false, stats:pseudo", - " │ │ ├─TableReader 9980.01 root data:Selection", - " │ │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t.a)), not(isnull(test.t.b))", - " │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t, partition:p1 keep order:false, stats:pseudo", - " │ │ └─TableReader 9980.01 root data:Selection", - " │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t.a)), not(isnull(test.t.b))", - " │ │ └─TableFullScan 10000.00 cop[tikv] table:t, partition:p2 keep order:false, stats:pseudo", - " │ └─PartitionUnion(Probe) 39960.00 root ", - " │ ├─TableReader 9990.00 root data:Selection", - " │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t4.a))", - " │ │ └─TableFullScan 10000.00 cop[tikv] table:t4, partition:p0 keep order:false, stats:pseudo", - " │ ├─TableReader 9990.00 root data:Selection", - " │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t4.a))", - " │ │ └─TableFullScan 10000.00 cop[tikv] table:t4, partition:p1 keep order:false, stats:pseudo", - " │ ├─TableReader 9990.00 root data:Selection", - " │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t4.a))", - " │ │ └─TableFullScan 10000.00 cop[tikv] table:t4, partition:p2 keep order:false, stats:pseudo", - " │ └─TableReader 9990.00 root data:Selection", - " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t4.a))", - " │ └─TableFullScan 10000.00 cop[tikv] table:t4, partition:p3 keep order:false, stats:pseudo", - " └─PartitionUnion(Probe) 49950.00 root ", - " ├─TableReader 9990.00 root data:Selection", - " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", - " │ └─TableFullScan 10000.00 cop[tikv] table:t2, partition:p0 keep order:false, stats:pseudo", - " ├─TableReader 9990.00 root data:Selection", - " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", - " │ └─TableFullScan 10000.00 cop[tikv] table:t2, partition:p1 keep order:false, stats:pseudo", - " ├─TableReader 9990.00 root data:Selection", - " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", - " │ └─TableFullScan 10000.00 cop[tikv] table:t2, partition:p2 keep order:false, stats:pseudo", - " ├─TableReader 9990.00 root data:Selection", - " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", - " │ └─TableFullScan 10000.00 cop[tikv] table:t2, partition:p3 keep order:false, stats:pseudo", - " └─TableReader 9990.00 root data:Selection", - " └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", - " └─TableFullScan 10000.00 cop[tikv] table:t2, partition:p4 keep order:false, stats:pseudo" + " ├─PartitionUnion(Build) 49950.00 root ", + " │ ├─TableReader 9990.00 root data:Selection", + " │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", + " │ │ └─TableFullScan 10000.00 cop[tikv] table:t2, partition:p0 keep order:false, stats:pseudo", + " │ ├─TableReader 9990.00 root data:Selection", + " │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", + " │ │ └─TableFullScan 10000.00 cop[tikv] table:t2, partition:p1 keep order:false, stats:pseudo", + " │ ├─TableReader 9990.00 root data:Selection", + " │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", + " │ │ └─TableFullScan 10000.00 cop[tikv] table:t2, partition:p2 keep order:false, stats:pseudo", + " │ ├─TableReader 9990.00 root data:Selection", + " │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", + " │ │ └─TableFullScan 10000.00 cop[tikv] table:t2, partition:p3 keep order:false, stats:pseudo", + " │ └─TableReader 9990.00 root data:Selection", + " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", + " │ └─TableFullScan 10000.00 cop[tikv] table:t2, partition:p4 keep order:false, stats:pseudo", + " └─HashJoin(Probe) 46781.30 root left outer join, equal:[eq(test.t.a, test.t1.a)]", + " ├─HashJoin(Build) 37425.04 root inner join, equal:[eq(test.t.a, test.t4.a)]", + " │ ├─PartitionUnion(Build) 29940.03 root ", + " │ │ ├─TableReader 9980.01 root data:Selection", + " │ │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t.a)), not(isnull(test.t.b))", + " │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t, partition:p0 keep order:false, stats:pseudo", + " │ │ ├─TableReader 9980.01 root data:Selection", + " │ │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t.a)), not(isnull(test.t.b))", + " │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t, partition:p1 keep order:false, stats:pseudo", + " │ │ └─TableReader 9980.01 root data:Selection", + " │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t.a)), not(isnull(test.t.b))", + " │ │ └─TableFullScan 10000.00 cop[tikv] table:t, partition:p2 keep order:false, stats:pseudo", + " │ └─PartitionUnion(Probe) 39960.00 root ", + " │ ├─TableReader 9990.00 root data:Selection", + " │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t4.a))", + " │ │ └─TableFullScan 10000.00 cop[tikv] table:t4, partition:p0 keep order:false, stats:pseudo", + " │ ├─TableReader 9990.00 root data:Selection", + " │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t4.a))", + " │ │ └─TableFullScan 10000.00 cop[tikv] table:t4, partition:p1 keep order:false, stats:pseudo", + " │ ├─TableReader 9990.00 root data:Selection", + " │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t4.a))", + " │ │ └─TableFullScan 10000.00 cop[tikv] table:t4, partition:p2 keep order:false, stats:pseudo", + " │ └─TableReader 9990.00 root data:Selection", + " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t4.a))", + " │ └─TableFullScan 10000.00 cop[tikv] table:t4, partition:p3 keep order:false, stats:pseudo", + " └─PartitionUnion(Probe) 39960.00 root ", + " ├─TableReader 9990.00 root data:Selection", + " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.a))", + " │ └─TableFullScan 10000.00 cop[tikv] table:t1, partition:p0 keep order:false, stats:pseudo", + " ├─TableReader 9990.00 root data:Selection", + " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.a))", + " │ └─TableFullScan 10000.00 cop[tikv] table:t1, partition:p1 keep order:false, stats:pseudo", + " ├─TableReader 9990.00 root data:Selection", + " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.a))", + " │ └─TableFullScan 10000.00 cop[tikv] table:t1, partition:p2 keep order:false, stats:pseudo", + " └─TableReader 9990.00 root data:Selection", + " └─Selection 9990.00 cop[tikv] not(isnull(test.t1.a))", + " └─TableFullScan 10000.00 cop[tikv] table:t1, partition:p3 keep order:false, stats:pseudo" ], "Warning": [ "Warning 1815 leading hint is inapplicable, check if the leading hint table is valid" @@ -2608,60 +2608,60 @@ " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t3.b))", " │ └─TableFullScan 10000.00 cop[tikv] table:t3, partition:p2 keep order:false, stats:pseudo", " └─HashJoin(Probe) 58476.62 root inner join, equal:[eq(test.t.b, test.t2.b)]", - " ├─HashJoin(Build) 46781.30 root left outer join, equal:[eq(test.t.a, test.t1.a)]", - " │ ├─PartitionUnion(Build) 39960.00 root ", - " │ │ ├─TableReader 9990.00 root data:Selection", - " │ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.a))", - " │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1, partition:p0 keep order:false, stats:pseudo", - " │ │ ├─TableReader 9990.00 root data:Selection", - " │ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.a))", - " │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1, partition:p1 keep order:false, stats:pseudo", - " │ │ ├─TableReader 9990.00 root data:Selection", - " │ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.a))", - " │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1, partition:p2 keep order:false, stats:pseudo", - " │ │ └─TableReader 9990.00 root data:Selection", - " │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.a))", - " │ │ └─TableFullScan 10000.00 cop[tikv] table:t1, partition:p3 keep order:false, stats:pseudo", - " │ └─HashJoin(Probe) 37425.04 root inner join, equal:[eq(test.t.a, test.t4.a)]", - " │ ├─PartitionUnion(Build) 29940.03 root ", - " │ │ ├─TableReader 9980.01 root data:Selection", - " │ │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t.a)), not(isnull(test.t.b))", - " │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t, partition:p0 keep order:false, stats:pseudo", - " │ │ ├─TableReader 9980.01 root data:Selection", - " │ │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t.a)), not(isnull(test.t.b))", - " │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t, partition:p1 keep order:false, stats:pseudo", - " │ │ └─TableReader 9980.01 root data:Selection", - " │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t.a)), not(isnull(test.t.b))", - " │ │ └─TableFullScan 10000.00 cop[tikv] table:t, partition:p2 keep order:false, stats:pseudo", - " │ └─PartitionUnion(Probe) 39960.00 root ", - " │ ├─TableReader 9990.00 root data:Selection", - " │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t4.a))", - " │ │ └─TableFullScan 10000.00 cop[tikv] table:t4, partition:p0 keep order:false, stats:pseudo", - " │ ├─TableReader 9990.00 root data:Selection", - " │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t4.a))", - " │ │ └─TableFullScan 10000.00 cop[tikv] table:t4, partition:p1 keep order:false, stats:pseudo", - " │ ├─TableReader 9990.00 root data:Selection", - " │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t4.a))", - " │ │ └─TableFullScan 10000.00 cop[tikv] table:t4, partition:p2 keep order:false, stats:pseudo", - " │ └─TableReader 9990.00 root data:Selection", - " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t4.a))", - " │ └─TableFullScan 10000.00 cop[tikv] table:t4, partition:p3 keep order:false, stats:pseudo", - " └─PartitionUnion(Probe) 49950.00 root ", - " ├─TableReader 9990.00 root data:Selection", - " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", - " │ └─TableFullScan 10000.00 cop[tikv] table:t2, partition:p0 keep order:false, stats:pseudo", - " ├─TableReader 9990.00 root data:Selection", - " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", - " │ └─TableFullScan 10000.00 cop[tikv] table:t2, partition:p1 keep order:false, stats:pseudo", - " ├─TableReader 9990.00 root data:Selection", - " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", - " │ └─TableFullScan 10000.00 cop[tikv] table:t2, partition:p2 keep order:false, stats:pseudo", - " ├─TableReader 9990.00 root data:Selection", - " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", - " │ └─TableFullScan 10000.00 cop[tikv] table:t2, partition:p3 keep order:false, stats:pseudo", - " └─TableReader 9990.00 root data:Selection", - " └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", - " └─TableFullScan 10000.00 cop[tikv] table:t2, partition:p4 keep order:false, stats:pseudo" + " ├─PartitionUnion(Build) 49950.00 root ", + " │ ├─TableReader 9990.00 root data:Selection", + " │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", + " │ │ └─TableFullScan 10000.00 cop[tikv] table:t2, partition:p0 keep order:false, stats:pseudo", + " │ ├─TableReader 9990.00 root data:Selection", + " │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", + " │ │ └─TableFullScan 10000.00 cop[tikv] table:t2, partition:p1 keep order:false, stats:pseudo", + " │ ├─TableReader 9990.00 root data:Selection", + " │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", + " │ │ └─TableFullScan 10000.00 cop[tikv] table:t2, partition:p2 keep order:false, stats:pseudo", + " │ ├─TableReader 9990.00 root data:Selection", + " │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", + " │ │ └─TableFullScan 10000.00 cop[tikv] table:t2, partition:p3 keep order:false, stats:pseudo", + " │ └─TableReader 9990.00 root data:Selection", + " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", + " │ └─TableFullScan 10000.00 cop[tikv] table:t2, partition:p4 keep order:false, stats:pseudo", + " └─HashJoin(Probe) 46781.30 root left outer join, equal:[eq(test.t.a, test.t1.a)]", + " ├─HashJoin(Build) 37425.04 root inner join, equal:[eq(test.t.a, test.t4.a)]", + " │ ├─PartitionUnion(Build) 29940.03 root ", + " │ │ ├─TableReader 9980.01 root data:Selection", + " │ │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t.a)), not(isnull(test.t.b))", + " │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t, partition:p0 keep order:false, stats:pseudo", + " │ │ ├─TableReader 9980.01 root data:Selection", + " │ │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t.a)), not(isnull(test.t.b))", + " │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t, partition:p1 keep order:false, stats:pseudo", + " │ │ └─TableReader 9980.01 root data:Selection", + " │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t.a)), not(isnull(test.t.b))", + " │ │ └─TableFullScan 10000.00 cop[tikv] table:t, partition:p2 keep order:false, stats:pseudo", + " │ └─PartitionUnion(Probe) 39960.00 root ", + " │ ├─TableReader 9990.00 root data:Selection", + " │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t4.a))", + " │ │ └─TableFullScan 10000.00 cop[tikv] table:t4, partition:p0 keep order:false, stats:pseudo", + " │ ├─TableReader 9990.00 root data:Selection", + " │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t4.a))", + " │ │ └─TableFullScan 10000.00 cop[tikv] table:t4, partition:p1 keep order:false, stats:pseudo", + " │ ├─TableReader 9990.00 root data:Selection", + " │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t4.a))", + " │ │ └─TableFullScan 10000.00 cop[tikv] table:t4, partition:p2 keep order:false, stats:pseudo", + " │ └─TableReader 9990.00 root data:Selection", + " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t4.a))", + " │ └─TableFullScan 10000.00 cop[tikv] table:t4, partition:p3 keep order:false, stats:pseudo", + " └─PartitionUnion(Probe) 39960.00 root ", + " ├─TableReader 9990.00 root data:Selection", + " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.a))", + " │ └─TableFullScan 10000.00 cop[tikv] table:t1, partition:p0 keep order:false, stats:pseudo", + " ├─TableReader 9990.00 root data:Selection", + " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.a))", + " │ └─TableFullScan 10000.00 cop[tikv] table:t1, partition:p1 keep order:false, stats:pseudo", + " ├─TableReader 9990.00 root data:Selection", + " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.a))", + " │ └─TableFullScan 10000.00 cop[tikv] table:t1, partition:p2 keep order:false, stats:pseudo", + " └─TableReader 9990.00 root data:Selection", + " └─Selection 9990.00 cop[tikv] not(isnull(test.t1.a))", + " └─TableFullScan 10000.00 cop[tikv] table:t1, partition:p3 keep order:false, stats:pseudo" ], "Warning": [ "Warning 1815 leading hint is inapplicable, check if the leading hint table is valid" @@ -2683,60 +2683,60 @@ " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t3.b))", " │ └─TableFullScan 10000.00 cop[tikv] table:t3, partition:p2 keep order:false, stats:pseudo", " └─HashJoin(Probe) 58476.62 root inner join, equal:[eq(test.t.b, test.t2.b)]", - " ├─HashJoin(Build) 46781.30 root left outer join, equal:[eq(test.t.a, test.t1.a)]", - " │ ├─PartitionUnion(Build) 39960.00 root ", - " │ │ ├─TableReader 9990.00 root data:Selection", - " │ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.a))", - " │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1, partition:p0 keep order:false, stats:pseudo", - " │ │ ├─TableReader 9990.00 root data:Selection", - " │ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.a))", - " │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1, partition:p1 keep order:false, stats:pseudo", - " │ │ ├─TableReader 9990.00 root data:Selection", - " │ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.a))", - " │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1, partition:p2 keep order:false, stats:pseudo", - " │ │ └─TableReader 9990.00 root data:Selection", - " │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.a))", - " │ │ └─TableFullScan 10000.00 cop[tikv] table:t1, partition:p3 keep order:false, stats:pseudo", - " │ └─HashJoin(Probe) 37425.04 root inner join, equal:[eq(test.t.a, test.t4.a)]", - " │ ├─PartitionUnion(Build) 29940.03 root ", - " │ │ ├─TableReader 9980.01 root data:Selection", - " │ │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t.a)), not(isnull(test.t.b))", - " │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t, partition:p0 keep order:false, stats:pseudo", - " │ │ ├─TableReader 9980.01 root data:Selection", - " │ │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t.a)), not(isnull(test.t.b))", - " │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t, partition:p1 keep order:false, stats:pseudo", - " │ │ └─TableReader 9980.01 root data:Selection", - " │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t.a)), not(isnull(test.t.b))", - " │ │ └─TableFullScan 10000.00 cop[tikv] table:t, partition:p2 keep order:false, stats:pseudo", - " │ └─PartitionUnion(Probe) 39960.00 root ", - " │ ├─TableReader 9990.00 root data:Selection", - " │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t4.a))", - " │ │ └─TableFullScan 10000.00 cop[tikv] table:t4, partition:p0 keep order:false, stats:pseudo", - " │ ├─TableReader 9990.00 root data:Selection", - " │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t4.a))", - " │ │ └─TableFullScan 10000.00 cop[tikv] table:t4, partition:p1 keep order:false, stats:pseudo", - " │ ├─TableReader 9990.00 root data:Selection", - " │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t4.a))", - " │ │ └─TableFullScan 10000.00 cop[tikv] table:t4, partition:p2 keep order:false, stats:pseudo", - " │ └─TableReader 9990.00 root data:Selection", - " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t4.a))", - " │ └─TableFullScan 10000.00 cop[tikv] table:t4, partition:p3 keep order:false, stats:pseudo", - " └─PartitionUnion(Probe) 49950.00 root ", - " ├─TableReader 9990.00 root data:Selection", - " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", - " │ └─TableFullScan 10000.00 cop[tikv] table:t2, partition:p0 keep order:false, stats:pseudo", - " ├─TableReader 9990.00 root data:Selection", - " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", - " │ └─TableFullScan 10000.00 cop[tikv] table:t2, partition:p1 keep order:false, stats:pseudo", - " ├─TableReader 9990.00 root data:Selection", - " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", - " │ └─TableFullScan 10000.00 cop[tikv] table:t2, partition:p2 keep order:false, stats:pseudo", - " ├─TableReader 9990.00 root data:Selection", - " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", - " │ └─TableFullScan 10000.00 cop[tikv] table:t2, partition:p3 keep order:false, stats:pseudo", - " └─TableReader 9990.00 root data:Selection", - " └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", - " └─TableFullScan 10000.00 cop[tikv] table:t2, partition:p4 keep order:false, stats:pseudo" + " ├─PartitionUnion(Build) 49950.00 root ", + " │ ├─TableReader 9990.00 root data:Selection", + " │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", + " │ │ └─TableFullScan 10000.00 cop[tikv] table:t2, partition:p0 keep order:false, stats:pseudo", + " │ ├─TableReader 9990.00 root data:Selection", + " │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", + " │ │ └─TableFullScan 10000.00 cop[tikv] table:t2, partition:p1 keep order:false, stats:pseudo", + " │ ├─TableReader 9990.00 root data:Selection", + " │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", + " │ │ └─TableFullScan 10000.00 cop[tikv] table:t2, partition:p2 keep order:false, stats:pseudo", + " │ ├─TableReader 9990.00 root data:Selection", + " │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", + " │ │ └─TableFullScan 10000.00 cop[tikv] table:t2, partition:p3 keep order:false, stats:pseudo", + " │ └─TableReader 9990.00 root data:Selection", + " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", + " │ └─TableFullScan 10000.00 cop[tikv] table:t2, partition:p4 keep order:false, stats:pseudo", + " └─HashJoin(Probe) 46781.30 root left outer join, equal:[eq(test.t.a, test.t1.a)]", + " ├─HashJoin(Build) 37425.04 root inner join, equal:[eq(test.t.a, test.t4.a)]", + " │ ├─PartitionUnion(Build) 29940.03 root ", + " │ │ ├─TableReader 9980.01 root data:Selection", + " │ │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t.a)), not(isnull(test.t.b))", + " │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t, partition:p0 keep order:false, stats:pseudo", + " │ │ ├─TableReader 9980.01 root data:Selection", + " │ │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t.a)), not(isnull(test.t.b))", + " │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t, partition:p1 keep order:false, stats:pseudo", + " │ │ └─TableReader 9980.01 root data:Selection", + " │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t.a)), not(isnull(test.t.b))", + " │ │ └─TableFullScan 10000.00 cop[tikv] table:t, partition:p2 keep order:false, stats:pseudo", + " │ └─PartitionUnion(Probe) 39960.00 root ", + " │ ├─TableReader 9990.00 root data:Selection", + " │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t4.a))", + " │ │ └─TableFullScan 10000.00 cop[tikv] table:t4, partition:p0 keep order:false, stats:pseudo", + " │ ├─TableReader 9990.00 root data:Selection", + " │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t4.a))", + " │ │ └─TableFullScan 10000.00 cop[tikv] table:t4, partition:p1 keep order:false, stats:pseudo", + " │ ├─TableReader 9990.00 root data:Selection", + " │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t4.a))", + " │ │ └─TableFullScan 10000.00 cop[tikv] table:t4, partition:p2 keep order:false, stats:pseudo", + " │ └─TableReader 9990.00 root data:Selection", + " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t4.a))", + " │ └─TableFullScan 10000.00 cop[tikv] table:t4, partition:p3 keep order:false, stats:pseudo", + " └─PartitionUnion(Probe) 39960.00 root ", + " ├─TableReader 9990.00 root data:Selection", + " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.a))", + " │ └─TableFullScan 10000.00 cop[tikv] table:t1, partition:p0 keep order:false, stats:pseudo", + " ├─TableReader 9990.00 root data:Selection", + " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.a))", + " │ └─TableFullScan 10000.00 cop[tikv] table:t1, partition:p1 keep order:false, stats:pseudo", + " ├─TableReader 9990.00 root data:Selection", + " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.a))", + " │ └─TableFullScan 10000.00 cop[tikv] table:t1, partition:p2 keep order:false, stats:pseudo", + " └─TableReader 9990.00 root data:Selection", + " └─Selection 9990.00 cop[tikv] not(isnull(test.t1.a))", + " └─TableFullScan 10000.00 cop[tikv] table:t1, partition:p3 keep order:false, stats:pseudo" ], "Warning": [ "Warning 1815 leading hint is inapplicable, check if the leading hint table is valid" @@ -2758,60 +2758,60 @@ " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t3.b))", " │ └─TableFullScan 10000.00 cop[tikv] table:t3, partition:p2 keep order:false, stats:pseudo", " └─HashJoin(Probe) 58476.62 root inner join, equal:[eq(test.t.b, test.t2.b)]", - " ├─HashJoin(Build) 46781.30 root left outer join, equal:[eq(test.t.a, test.t1.a)]", - " │ ├─PartitionUnion(Build) 39960.00 root ", - " │ │ ├─TableReader 9990.00 root data:Selection", - " │ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.a))", - " │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1, partition:p0 keep order:false, stats:pseudo", - " │ │ ├─TableReader 9990.00 root data:Selection", - " │ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.a))", - " │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1, partition:p1 keep order:false, stats:pseudo", - " │ │ ├─TableReader 9990.00 root data:Selection", - " │ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.a))", - " │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1, partition:p2 keep order:false, stats:pseudo", - " │ │ └─TableReader 9990.00 root data:Selection", - " │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.a))", - " │ │ └─TableFullScan 10000.00 cop[tikv] table:t1, partition:p3 keep order:false, stats:pseudo", - " │ └─HashJoin(Probe) 37425.04 root inner join, equal:[eq(test.t.a, test.t4.a)]", - " │ ├─PartitionUnion(Build) 29940.03 root ", - " │ │ ├─TableReader 9980.01 root data:Selection", - " │ │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t.a)), not(isnull(test.t.b))", - " │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t, partition:p0 keep order:false, stats:pseudo", - " │ │ ├─TableReader 9980.01 root data:Selection", - " │ │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t.a)), not(isnull(test.t.b))", - " │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t, partition:p1 keep order:false, stats:pseudo", - " │ │ └─TableReader 9980.01 root data:Selection", - " │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t.a)), not(isnull(test.t.b))", - " │ │ └─TableFullScan 10000.00 cop[tikv] table:t, partition:p2 keep order:false, stats:pseudo", - " │ └─PartitionUnion(Probe) 39960.00 root ", - " │ ├─TableReader 9990.00 root data:Selection", - " │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t4.a))", - " │ │ └─TableFullScan 10000.00 cop[tikv] table:t4, partition:p0 keep order:false, stats:pseudo", - " │ ├─TableReader 9990.00 root data:Selection", - " │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t4.a))", - " │ │ └─TableFullScan 10000.00 cop[tikv] table:t4, partition:p1 keep order:false, stats:pseudo", - " │ ├─TableReader 9990.00 root data:Selection", - " │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t4.a))", - " │ │ └─TableFullScan 10000.00 cop[tikv] table:t4, partition:p2 keep order:false, stats:pseudo", - " │ └─TableReader 9990.00 root data:Selection", - " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t4.a))", - " │ └─TableFullScan 10000.00 cop[tikv] table:t4, partition:p3 keep order:false, stats:pseudo", - " └─PartitionUnion(Probe) 49950.00 root ", - " ├─TableReader 9990.00 root data:Selection", - " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", - " │ └─TableFullScan 10000.00 cop[tikv] table:t2, partition:p0 keep order:false, stats:pseudo", - " ├─TableReader 9990.00 root data:Selection", - " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", - " │ └─TableFullScan 10000.00 cop[tikv] table:t2, partition:p1 keep order:false, stats:pseudo", - " ├─TableReader 9990.00 root data:Selection", - " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", - " │ └─TableFullScan 10000.00 cop[tikv] table:t2, partition:p2 keep order:false, stats:pseudo", - " ├─TableReader 9990.00 root data:Selection", - " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", - " │ └─TableFullScan 10000.00 cop[tikv] table:t2, partition:p3 keep order:false, stats:pseudo", - " └─TableReader 9990.00 root data:Selection", - " └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", - " └─TableFullScan 10000.00 cop[tikv] table:t2, partition:p4 keep order:false, stats:pseudo" + " ├─PartitionUnion(Build) 49950.00 root ", + " │ ├─TableReader 9990.00 root data:Selection", + " │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", + " │ │ └─TableFullScan 10000.00 cop[tikv] table:t2, partition:p0 keep order:false, stats:pseudo", + " │ ├─TableReader 9990.00 root data:Selection", + " │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", + " │ │ └─TableFullScan 10000.00 cop[tikv] table:t2, partition:p1 keep order:false, stats:pseudo", + " │ ├─TableReader 9990.00 root data:Selection", + " │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", + " │ │ └─TableFullScan 10000.00 cop[tikv] table:t2, partition:p2 keep order:false, stats:pseudo", + " │ ├─TableReader 9990.00 root data:Selection", + " │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", + " │ │ └─TableFullScan 10000.00 cop[tikv] table:t2, partition:p3 keep order:false, stats:pseudo", + " │ └─TableReader 9990.00 root data:Selection", + " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", + " │ └─TableFullScan 10000.00 cop[tikv] table:t2, partition:p4 keep order:false, stats:pseudo", + " └─HashJoin(Probe) 46781.30 root left outer join, equal:[eq(test.t.a, test.t1.a)]", + " ├─HashJoin(Build) 37425.04 root inner join, equal:[eq(test.t.a, test.t4.a)]", + " │ ├─PartitionUnion(Build) 29940.03 root ", + " │ │ ├─TableReader 9980.01 root data:Selection", + " │ │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t.a)), not(isnull(test.t.b))", + " │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t, partition:p0 keep order:false, stats:pseudo", + " │ │ ├─TableReader 9980.01 root data:Selection", + " │ │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t.a)), not(isnull(test.t.b))", + " │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t, partition:p1 keep order:false, stats:pseudo", + " │ │ └─TableReader 9980.01 root data:Selection", + " │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t.a)), not(isnull(test.t.b))", + " │ │ └─TableFullScan 10000.00 cop[tikv] table:t, partition:p2 keep order:false, stats:pseudo", + " │ └─PartitionUnion(Probe) 39960.00 root ", + " │ ├─TableReader 9990.00 root data:Selection", + " │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t4.a))", + " │ │ └─TableFullScan 10000.00 cop[tikv] table:t4, partition:p0 keep order:false, stats:pseudo", + " │ ├─TableReader 9990.00 root data:Selection", + " │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t4.a))", + " │ │ └─TableFullScan 10000.00 cop[tikv] table:t4, partition:p1 keep order:false, stats:pseudo", + " │ ├─TableReader 9990.00 root data:Selection", + " │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t4.a))", + " │ │ └─TableFullScan 10000.00 cop[tikv] table:t4, partition:p2 keep order:false, stats:pseudo", + " │ └─TableReader 9990.00 root data:Selection", + " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t4.a))", + " │ └─TableFullScan 10000.00 cop[tikv] table:t4, partition:p3 keep order:false, stats:pseudo", + " └─PartitionUnion(Probe) 39960.00 root ", + " ├─TableReader 9990.00 root data:Selection", + " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.a))", + " │ └─TableFullScan 10000.00 cop[tikv] table:t1, partition:p0 keep order:false, stats:pseudo", + " ├─TableReader 9990.00 root data:Selection", + " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.a))", + " │ └─TableFullScan 10000.00 cop[tikv] table:t1, partition:p1 keep order:false, stats:pseudo", + " ├─TableReader 9990.00 root data:Selection", + " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.a))", + " │ └─TableFullScan 10000.00 cop[tikv] table:t1, partition:p2 keep order:false, stats:pseudo", + " └─TableReader 9990.00 root data:Selection", + " └─Selection 9990.00 cop[tikv] not(isnull(test.t1.a))", + " └─TableFullScan 10000.00 cop[tikv] table:t1, partition:p3 keep order:false, stats:pseudo" ], "Warning": [ "Warning 1815 leading hint is inapplicable, check if the leading hint table is valid" @@ -2833,60 +2833,60 @@ " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t3.b))", " │ └─TableFullScan 10000.00 cop[tikv] table:t3, partition:p2 keep order:false, stats:pseudo", " └─HashJoin(Probe) 58476.62 root inner join, equal:[eq(test.t.b, test.t2.b)]", - " ├─HashJoin(Build) 46781.30 root left outer join, equal:[eq(test.t.a, test.t1.a)]", - " │ ├─PartitionUnion(Build) 39960.00 root ", - " │ │ ├─TableReader 9990.00 root data:Selection", - " │ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.a))", - " │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1, partition:p0 keep order:false, stats:pseudo", - " │ │ ├─TableReader 9990.00 root data:Selection", - " │ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.a))", - " │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1, partition:p1 keep order:false, stats:pseudo", - " │ │ ├─TableReader 9990.00 root data:Selection", - " │ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.a))", - " │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1, partition:p2 keep order:false, stats:pseudo", - " │ │ └─TableReader 9990.00 root data:Selection", - " │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.a))", - " │ │ └─TableFullScan 10000.00 cop[tikv] table:t1, partition:p3 keep order:false, stats:pseudo", - " │ └─HashJoin(Probe) 37425.04 root inner join, equal:[eq(test.t.a, test.t4.a)]", - " │ ├─PartitionUnion(Build) 29940.03 root ", - " │ │ ├─TableReader 9980.01 root data:Selection", - " │ │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t.a)), not(isnull(test.t.b))", - " │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t, partition:p0 keep order:false, stats:pseudo", - " │ │ ├─TableReader 9980.01 root data:Selection", - " │ │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t.a)), not(isnull(test.t.b))", - " │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t, partition:p1 keep order:false, stats:pseudo", - " │ │ └─TableReader 9980.01 root data:Selection", - " │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t.a)), not(isnull(test.t.b))", - " │ │ └─TableFullScan 10000.00 cop[tikv] table:t, partition:p2 keep order:false, stats:pseudo", - " │ └─PartitionUnion(Probe) 39960.00 root ", - " │ ├─TableReader 9990.00 root data:Selection", - " │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t4.a))", - " │ │ └─TableFullScan 10000.00 cop[tikv] table:t4, partition:p0 keep order:false, stats:pseudo", - " │ ├─TableReader 9990.00 root data:Selection", - " │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t4.a))", - " │ │ └─TableFullScan 10000.00 cop[tikv] table:t4, partition:p1 keep order:false, stats:pseudo", - " │ ├─TableReader 9990.00 root data:Selection", - " │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t4.a))", - " │ │ └─TableFullScan 10000.00 cop[tikv] table:t4, partition:p2 keep order:false, stats:pseudo", - " │ └─TableReader 9990.00 root data:Selection", - " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t4.a))", - " │ └─TableFullScan 10000.00 cop[tikv] table:t4, partition:p3 keep order:false, stats:pseudo", - " └─PartitionUnion(Probe) 49950.00 root ", - " ├─TableReader 9990.00 root data:Selection", - " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", - " │ └─TableFullScan 10000.00 cop[tikv] table:t2, partition:p0 keep order:false, stats:pseudo", - " ├─TableReader 9990.00 root data:Selection", - " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", - " │ └─TableFullScan 10000.00 cop[tikv] table:t2, partition:p1 keep order:false, stats:pseudo", - " ├─TableReader 9990.00 root data:Selection", - " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", - " │ └─TableFullScan 10000.00 cop[tikv] table:t2, partition:p2 keep order:false, stats:pseudo", - " ├─TableReader 9990.00 root data:Selection", - " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", - " │ └─TableFullScan 10000.00 cop[tikv] table:t2, partition:p3 keep order:false, stats:pseudo", - " └─TableReader 9990.00 root data:Selection", - " └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", - " └─TableFullScan 10000.00 cop[tikv] table:t2, partition:p4 keep order:false, stats:pseudo" + " ├─PartitionUnion(Build) 49950.00 root ", + " │ ├─TableReader 9990.00 root data:Selection", + " │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", + " │ │ └─TableFullScan 10000.00 cop[tikv] table:t2, partition:p0 keep order:false, stats:pseudo", + " │ ├─TableReader 9990.00 root data:Selection", + " │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", + " │ │ └─TableFullScan 10000.00 cop[tikv] table:t2, partition:p1 keep order:false, stats:pseudo", + " │ ├─TableReader 9990.00 root data:Selection", + " │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", + " │ │ └─TableFullScan 10000.00 cop[tikv] table:t2, partition:p2 keep order:false, stats:pseudo", + " │ ├─TableReader 9990.00 root data:Selection", + " │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", + " │ │ └─TableFullScan 10000.00 cop[tikv] table:t2, partition:p3 keep order:false, stats:pseudo", + " │ └─TableReader 9990.00 root data:Selection", + " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", + " │ └─TableFullScan 10000.00 cop[tikv] table:t2, partition:p4 keep order:false, stats:pseudo", + " └─HashJoin(Probe) 46781.30 root left outer join, equal:[eq(test.t.a, test.t1.a)]", + " ├─HashJoin(Build) 37425.04 root inner join, equal:[eq(test.t.a, test.t4.a)]", + " │ ├─PartitionUnion(Build) 29940.03 root ", + " │ │ ├─TableReader 9980.01 root data:Selection", + " │ │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t.a)), not(isnull(test.t.b))", + " │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t, partition:p0 keep order:false, stats:pseudo", + " │ │ ├─TableReader 9980.01 root data:Selection", + " │ │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t.a)), not(isnull(test.t.b))", + " │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t, partition:p1 keep order:false, stats:pseudo", + " │ │ └─TableReader 9980.01 root data:Selection", + " │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t.a)), not(isnull(test.t.b))", + " │ │ └─TableFullScan 10000.00 cop[tikv] table:t, partition:p2 keep order:false, stats:pseudo", + " │ └─PartitionUnion(Probe) 39960.00 root ", + " │ ├─TableReader 9990.00 root data:Selection", + " │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t4.a))", + " │ │ └─TableFullScan 10000.00 cop[tikv] table:t4, partition:p0 keep order:false, stats:pseudo", + " │ ├─TableReader 9990.00 root data:Selection", + " │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t4.a))", + " │ │ └─TableFullScan 10000.00 cop[tikv] table:t4, partition:p1 keep order:false, stats:pseudo", + " │ ├─TableReader 9990.00 root data:Selection", + " │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t4.a))", + " │ │ └─TableFullScan 10000.00 cop[tikv] table:t4, partition:p2 keep order:false, stats:pseudo", + " │ └─TableReader 9990.00 root data:Selection", + " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t4.a))", + " │ └─TableFullScan 10000.00 cop[tikv] table:t4, partition:p3 keep order:false, stats:pseudo", + " └─PartitionUnion(Probe) 39960.00 root ", + " ├─TableReader 9990.00 root data:Selection", + " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.a))", + " │ └─TableFullScan 10000.00 cop[tikv] table:t1, partition:p0 keep order:false, stats:pseudo", + " ├─TableReader 9990.00 root data:Selection", + " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.a))", + " │ └─TableFullScan 10000.00 cop[tikv] table:t1, partition:p1 keep order:false, stats:pseudo", + " ├─TableReader 9990.00 root data:Selection", + " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.a))", + " │ └─TableFullScan 10000.00 cop[tikv] table:t1, partition:p2 keep order:false, stats:pseudo", + " └─TableReader 9990.00 root data:Selection", + " └─Selection 9990.00 cop[tikv] not(isnull(test.t1.a))", + " └─TableFullScan 10000.00 cop[tikv] table:t1, partition:p3 keep order:false, stats:pseudo" ], "Warning": [ "Warning 1815 leading hint is inapplicable, check if the leading hint table is valid" @@ -2985,56 +2985,56 @@ "SQL": "select /*+ leading(t2, t3) */ * from t2 left join (t1 join t3 on t1.a=t3.a join t4 on t3.b = t4.b) on t2.b=t1.b;", "Plan": [ "HashJoin 58476.62 root left outer join, equal:[eq(test.t2.b, test.t1.b)]", - "├─Projection(Build) 46781.30 root test.t1.a, test.t1.b, test.t3.a, test.t3.b, test.t4.a, test.t4.b", - "│ └─HashJoin 46781.30 root inner join, equal:[eq(test.t3.b, test.t4.b)]", - "│ ├─HashJoin(Build) 37425.04 root inner join, equal:[eq(test.t3.a, test.t1.a)]", - "│ │ ├─PartitionUnion(Build) 29940.03 root ", - "│ │ │ ├─TableReader 9980.01 root data:Selection", - "│ │ │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t3.a)), not(isnull(test.t3.b))", - "│ │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t3, partition:p0 keep order:false, stats:pseudo", - "│ │ │ ├─TableReader 9980.01 root data:Selection", - "│ │ │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t3.a)), not(isnull(test.t3.b))", - "│ │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t3, partition:p1 keep order:false, stats:pseudo", - "│ │ │ └─TableReader 9980.01 root data:Selection", - "│ │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t3.a)), not(isnull(test.t3.b))", - "│ │ │ └─TableFullScan 10000.00 cop[tikv] table:t3, partition:p2 keep order:false, stats:pseudo", - "│ │ └─PartitionUnion(Probe) 39920.04 root ", - "│ │ ├─TableReader 9980.01 root data:Selection", - "│ │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t1.a)), not(isnull(test.t1.b))", - "│ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1, partition:p0 keep order:false, stats:pseudo", - "│ │ ├─TableReader 9980.01 root data:Selection", - "│ │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t1.a)), not(isnull(test.t1.b))", - "│ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1, partition:p1 keep order:false, stats:pseudo", - "│ │ ├─TableReader 9980.01 root data:Selection", - "│ │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t1.a)), not(isnull(test.t1.b))", - "│ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1, partition:p2 keep order:false, stats:pseudo", - "│ │ └─TableReader 9980.01 root data:Selection", - "│ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t1.a)), not(isnull(test.t1.b))", - "│ │ └─TableFullScan 10000.00 cop[tikv] table:t1, partition:p3 keep order:false, stats:pseudo", - "│ └─PartitionUnion(Probe) 39960.00 root ", - "│ ├─TableReader 9990.00 root data:Selection", - "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t4.b))", - "│ │ └─TableFullScan 10000.00 cop[tikv] table:t4, partition:p0 keep order:false, stats:pseudo", - "│ ├─TableReader 9990.00 root data:Selection", - "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t4.b))", - "│ │ └─TableFullScan 10000.00 cop[tikv] table:t4, partition:p1 keep order:false, stats:pseudo", - "│ ├─TableReader 9990.00 root data:Selection", - "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t4.b))", - "│ │ └─TableFullScan 10000.00 cop[tikv] table:t4, partition:p2 keep order:false, stats:pseudo", - "│ └─TableReader 9990.00 root data:Selection", - "│ └─Selection 9990.00 cop[tikv] not(isnull(test.t4.b))", - "│ └─TableFullScan 10000.00 cop[tikv] table:t4, partition:p3 keep order:false, stats:pseudo", - "└─PartitionUnion(Probe) 50000.00 root ", - " ├─TableReader 10000.00 root data:TableFullScan", - " │ └─TableFullScan 10000.00 cop[tikv] table:t2, partition:p0 keep order:false, stats:pseudo", - " ├─TableReader 10000.00 root data:TableFullScan", - " │ └─TableFullScan 10000.00 cop[tikv] table:t2, partition:p1 keep order:false, stats:pseudo", - " ├─TableReader 10000.00 root data:TableFullScan", - " │ └─TableFullScan 10000.00 cop[tikv] table:t2, partition:p2 keep order:false, stats:pseudo", - " ├─TableReader 10000.00 root data:TableFullScan", - " │ └─TableFullScan 10000.00 cop[tikv] table:t2, partition:p3 keep order:false, stats:pseudo", - " └─TableReader 10000.00 root data:TableFullScan", - " └─TableFullScan 10000.00 cop[tikv] table:t2, partition:p4 keep order:false, stats:pseudo" + "├─PartitionUnion(Build) 50000.00 root ", + "│ ├─TableReader 10000.00 root data:TableFullScan", + "│ │ └─TableFullScan 10000.00 cop[tikv] table:t2, partition:p0 keep order:false, stats:pseudo", + "│ ├─TableReader 10000.00 root data:TableFullScan", + "│ │ └─TableFullScan 10000.00 cop[tikv] table:t2, partition:p1 keep order:false, stats:pseudo", + "│ ├─TableReader 10000.00 root data:TableFullScan", + "│ │ └─TableFullScan 10000.00 cop[tikv] table:t2, partition:p2 keep order:false, stats:pseudo", + "│ ├─TableReader 10000.00 root data:TableFullScan", + "│ │ └─TableFullScan 10000.00 cop[tikv] table:t2, partition:p3 keep order:false, stats:pseudo", + "│ └─TableReader 10000.00 root data:TableFullScan", + "│ └─TableFullScan 10000.00 cop[tikv] table:t2, partition:p4 keep order:false, stats:pseudo", + "└─Projection(Probe) 46781.30 root test.t1.a, test.t1.b, test.t3.a, test.t3.b, test.t4.a, test.t4.b", + " └─HashJoin 46781.30 root inner join, equal:[eq(test.t3.b, test.t4.b)]", + " ├─HashJoin(Build) 37425.04 root inner join, equal:[eq(test.t3.a, test.t1.a)]", + " │ ├─PartitionUnion(Build) 29940.03 root ", + " │ │ ├─TableReader 9980.01 root data:Selection", + " │ │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t3.a)), not(isnull(test.t3.b))", + " │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t3, partition:p0 keep order:false, stats:pseudo", + " │ │ ├─TableReader 9980.01 root data:Selection", + " │ │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t3.a)), not(isnull(test.t3.b))", + " │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t3, partition:p1 keep order:false, stats:pseudo", + " │ │ └─TableReader 9980.01 root data:Selection", + " │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t3.a)), not(isnull(test.t3.b))", + " │ │ └─TableFullScan 10000.00 cop[tikv] table:t3, partition:p2 keep order:false, stats:pseudo", + " │ └─PartitionUnion(Probe) 39920.04 root ", + " │ ├─TableReader 9980.01 root data:Selection", + " │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t1.a)), not(isnull(test.t1.b))", + " │ │ └─TableFullScan 10000.00 cop[tikv] table:t1, partition:p0 keep order:false, stats:pseudo", + " │ ├─TableReader 9980.01 root data:Selection", + " │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t1.a)), not(isnull(test.t1.b))", + " │ │ └─TableFullScan 10000.00 cop[tikv] table:t1, partition:p1 keep order:false, stats:pseudo", + " │ ├─TableReader 9980.01 root data:Selection", + " │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t1.a)), not(isnull(test.t1.b))", + " │ │ └─TableFullScan 10000.00 cop[tikv] table:t1, partition:p2 keep order:false, stats:pseudo", + " │ └─TableReader 9980.01 root data:Selection", + " │ └─Selection 9980.01 cop[tikv] not(isnull(test.t1.a)), not(isnull(test.t1.b))", + " │ └─TableFullScan 10000.00 cop[tikv] table:t1, partition:p3 keep order:false, stats:pseudo", + " └─PartitionUnion(Probe) 39960.00 root ", + " ├─TableReader 9990.00 root data:Selection", + " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t4.b))", + " │ └─TableFullScan 10000.00 cop[tikv] table:t4, partition:p0 keep order:false, stats:pseudo", + " ├─TableReader 9990.00 root data:Selection", + " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t4.b))", + " │ └─TableFullScan 10000.00 cop[tikv] table:t4, partition:p1 keep order:false, stats:pseudo", + " ├─TableReader 9990.00 root data:Selection", + " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t4.b))", + " │ └─TableFullScan 10000.00 cop[tikv] table:t4, partition:p2 keep order:false, stats:pseudo", + " └─TableReader 9990.00 root data:Selection", + " └─Selection 9990.00 cop[tikv] not(isnull(test.t4.b))", + " └─TableFullScan 10000.00 cop[tikv] table:t4, partition:p3 keep order:false, stats:pseudo" ], "Warning": [ "Warning 1815 leading hint is inapplicable, check if the leading hint table is valid", @@ -3045,56 +3045,56 @@ "SQL": "select /*+ leading(t3, t4) */ * from t2 left join (t1 join t3 on t1.a=t3.a join t4 on t3.b = t4.b) on t2.b=t1.b;", "Plan": [ "HashJoin 58476.62 root left outer join, equal:[eq(test.t2.b, test.t1.b)]", - "├─Projection(Build) 46781.30 root test.t1.a, test.t1.b, test.t3.a, test.t3.b, test.t4.a, test.t4.b", - "│ └─HashJoin 46781.30 root inner join, equal:[eq(test.t3.b, test.t4.b)]", - "│ ├─HashJoin(Build) 37425.04 root inner join, equal:[eq(test.t3.a, test.t1.a)]", - "│ │ ├─PartitionUnion(Build) 29940.03 root ", - "│ │ │ ├─TableReader 9980.01 root data:Selection", - "│ │ │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t3.a)), not(isnull(test.t3.b))", - "│ │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t3, partition:p0 keep order:false, stats:pseudo", - "│ │ │ ├─TableReader 9980.01 root data:Selection", - "│ │ │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t3.a)), not(isnull(test.t3.b))", - "│ │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t3, partition:p1 keep order:false, stats:pseudo", - "│ │ │ └─TableReader 9980.01 root data:Selection", - "│ │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t3.a)), not(isnull(test.t3.b))", - "│ │ │ └─TableFullScan 10000.00 cop[tikv] table:t3, partition:p2 keep order:false, stats:pseudo", - "│ │ └─PartitionUnion(Probe) 39920.04 root ", - "│ │ ├─TableReader 9980.01 root data:Selection", - "│ │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t1.a)), not(isnull(test.t1.b))", - "│ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1, partition:p0 keep order:false, stats:pseudo", - "│ │ ├─TableReader 9980.01 root data:Selection", - "│ │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t1.a)), not(isnull(test.t1.b))", - "│ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1, partition:p1 keep order:false, stats:pseudo", - "│ │ ├─TableReader 9980.01 root data:Selection", - "│ │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t1.a)), not(isnull(test.t1.b))", - "│ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1, partition:p2 keep order:false, stats:pseudo", - "│ │ └─TableReader 9980.01 root data:Selection", - "│ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t1.a)), not(isnull(test.t1.b))", - "│ │ └─TableFullScan 10000.00 cop[tikv] table:t1, partition:p3 keep order:false, stats:pseudo", - "│ └─PartitionUnion(Probe) 39960.00 root ", - "│ ├─TableReader 9990.00 root data:Selection", - "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t4.b))", - "│ │ └─TableFullScan 10000.00 cop[tikv] table:t4, partition:p0 keep order:false, stats:pseudo", - "│ ├─TableReader 9990.00 root data:Selection", - "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t4.b))", - "│ │ └─TableFullScan 10000.00 cop[tikv] table:t4, partition:p1 keep order:false, stats:pseudo", - "│ ├─TableReader 9990.00 root data:Selection", - "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t4.b))", - "│ │ └─TableFullScan 10000.00 cop[tikv] table:t4, partition:p2 keep order:false, stats:pseudo", - "│ └─TableReader 9990.00 root data:Selection", - "│ └─Selection 9990.00 cop[tikv] not(isnull(test.t4.b))", - "│ └─TableFullScan 10000.00 cop[tikv] table:t4, partition:p3 keep order:false, stats:pseudo", - "└─PartitionUnion(Probe) 50000.00 root ", - " ├─TableReader 10000.00 root data:TableFullScan", - " │ └─TableFullScan 10000.00 cop[tikv] table:t2, partition:p0 keep order:false, stats:pseudo", - " ├─TableReader 10000.00 root data:TableFullScan", - " │ └─TableFullScan 10000.00 cop[tikv] table:t2, partition:p1 keep order:false, stats:pseudo", - " ├─TableReader 10000.00 root data:TableFullScan", - " │ └─TableFullScan 10000.00 cop[tikv] table:t2, partition:p2 keep order:false, stats:pseudo", - " ├─TableReader 10000.00 root data:TableFullScan", - " │ └─TableFullScan 10000.00 cop[tikv] table:t2, partition:p3 keep order:false, stats:pseudo", - " └─TableReader 10000.00 root data:TableFullScan", - " └─TableFullScan 10000.00 cop[tikv] table:t2, partition:p4 keep order:false, stats:pseudo" + "├─PartitionUnion(Build) 50000.00 root ", + "│ ├─TableReader 10000.00 root data:TableFullScan", + "│ │ └─TableFullScan 10000.00 cop[tikv] table:t2, partition:p0 keep order:false, stats:pseudo", + "│ ├─TableReader 10000.00 root data:TableFullScan", + "│ │ └─TableFullScan 10000.00 cop[tikv] table:t2, partition:p1 keep order:false, stats:pseudo", + "│ ├─TableReader 10000.00 root data:TableFullScan", + "│ │ └─TableFullScan 10000.00 cop[tikv] table:t2, partition:p2 keep order:false, stats:pseudo", + "│ ├─TableReader 10000.00 root data:TableFullScan", + "│ │ └─TableFullScan 10000.00 cop[tikv] table:t2, partition:p3 keep order:false, stats:pseudo", + "│ └─TableReader 10000.00 root data:TableFullScan", + "│ └─TableFullScan 10000.00 cop[tikv] table:t2, partition:p4 keep order:false, stats:pseudo", + "└─Projection(Probe) 46781.30 root test.t1.a, test.t1.b, test.t3.a, test.t3.b, test.t4.a, test.t4.b", + " └─HashJoin 46781.30 root inner join, equal:[eq(test.t3.b, test.t4.b)]", + " ├─HashJoin(Build) 37425.04 root inner join, equal:[eq(test.t3.a, test.t1.a)]", + " │ ├─PartitionUnion(Build) 29940.03 root ", + " │ │ ├─TableReader 9980.01 root data:Selection", + " │ │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t3.a)), not(isnull(test.t3.b))", + " │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t3, partition:p0 keep order:false, stats:pseudo", + " │ │ ├─TableReader 9980.01 root data:Selection", + " │ │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t3.a)), not(isnull(test.t3.b))", + " │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t3, partition:p1 keep order:false, stats:pseudo", + " │ │ └─TableReader 9980.01 root data:Selection", + " │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t3.a)), not(isnull(test.t3.b))", + " │ │ └─TableFullScan 10000.00 cop[tikv] table:t3, partition:p2 keep order:false, stats:pseudo", + " │ └─PartitionUnion(Probe) 39920.04 root ", + " │ ├─TableReader 9980.01 root data:Selection", + " │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t1.a)), not(isnull(test.t1.b))", + " │ │ └─TableFullScan 10000.00 cop[tikv] table:t1, partition:p0 keep order:false, stats:pseudo", + " │ ├─TableReader 9980.01 root data:Selection", + " │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t1.a)), not(isnull(test.t1.b))", + " │ │ └─TableFullScan 10000.00 cop[tikv] table:t1, partition:p1 keep order:false, stats:pseudo", + " │ ├─TableReader 9980.01 root data:Selection", + " │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t1.a)), not(isnull(test.t1.b))", + " │ │ └─TableFullScan 10000.00 cop[tikv] table:t1, partition:p2 keep order:false, stats:pseudo", + " │ └─TableReader 9980.01 root data:Selection", + " │ └─Selection 9980.01 cop[tikv] not(isnull(test.t1.a)), not(isnull(test.t1.b))", + " │ └─TableFullScan 10000.00 cop[tikv] table:t1, partition:p3 keep order:false, stats:pseudo", + " └─PartitionUnion(Probe) 39960.00 root ", + " ├─TableReader 9990.00 root data:Selection", + " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t4.b))", + " │ └─TableFullScan 10000.00 cop[tikv] table:t4, partition:p0 keep order:false, stats:pseudo", + " ├─TableReader 9990.00 root data:Selection", + " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t4.b))", + " │ └─TableFullScan 10000.00 cop[tikv] table:t4, partition:p1 keep order:false, stats:pseudo", + " ├─TableReader 9990.00 root data:Selection", + " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t4.b))", + " │ └─TableFullScan 10000.00 cop[tikv] table:t4, partition:p2 keep order:false, stats:pseudo", + " └─TableReader 9990.00 root data:Selection", + " └─Selection 9990.00 cop[tikv] not(isnull(test.t4.b))", + " └─TableFullScan 10000.00 cop[tikv] table:t4, partition:p3 keep order:false, stats:pseudo" ], "Warning": [ "Warning 1815 leading hint is inapplicable, check if the leading hint table is valid" @@ -3859,60 +3859,60 @@ " │ └─Selection 9980.01 cop[tikv] not(isnull(test.t5.a)), not(isnull(test.t5.b))", " │ └─TableFullScan 10000.00 cop[tikv] table:t5, partition:p4 keep order:false, stats:pseudo", " └─HashJoin(Probe) 58476.62 root inner join, equal:[eq(test.t1.b, test.t2.b)]", - " ├─HashJoin(Build) 46781.30 root inner join, equal:[eq(test.t3.b, test.t4.b)]", - " │ ├─HashJoin(Build) 37425.04 root inner join, equal:[eq(test.t3.a, test.t1.a)]", - " │ │ ├─PartitionUnion(Build) 29940.03 root ", - " │ │ │ ├─TableReader 9980.01 root data:Selection", - " │ │ │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t3.a)), not(isnull(test.t3.b))", - " │ │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t3, partition:p0 keep order:false, stats:pseudo", - " │ │ │ ├─TableReader 9980.01 root data:Selection", - " │ │ │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t3.a)), not(isnull(test.t3.b))", - " │ │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t3, partition:p1 keep order:false, stats:pseudo", - " │ │ │ └─TableReader 9980.01 root data:Selection", - " │ │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t3.a)), not(isnull(test.t3.b))", - " │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t3, partition:p2 keep order:false, stats:pseudo", - " │ │ └─PartitionUnion(Probe) 39920.04 root ", - " │ │ ├─TableReader 9980.01 root data:Selection", - " │ │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t1.a)), not(isnull(test.t1.b))", - " │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1, partition:p0 keep order:false, stats:pseudo", - " │ │ ├─TableReader 9980.01 root data:Selection", - " │ │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t1.a)), not(isnull(test.t1.b))", - " │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1, partition:p1 keep order:false, stats:pseudo", - " │ │ ├─TableReader 9980.01 root data:Selection", - " │ │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t1.a)), not(isnull(test.t1.b))", - " │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1, partition:p2 keep order:false, stats:pseudo", - " │ │ └─TableReader 9980.01 root data:Selection", - " │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t1.a)), not(isnull(test.t1.b))", - " │ │ └─TableFullScan 10000.00 cop[tikv] table:t1, partition:p3 keep order:false, stats:pseudo", - " │ └─PartitionUnion(Probe) 39960.00 root ", - " │ ├─TableReader 9990.00 root data:Selection", - " │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t4.b))", - " │ │ └─TableFullScan 10000.00 cop[tikv] table:t4, partition:p0 keep order:false, stats:pseudo", - " │ ├─TableReader 9990.00 root data:Selection", - " │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t4.b))", - " │ │ └─TableFullScan 10000.00 cop[tikv] table:t4, partition:p1 keep order:false, stats:pseudo", - " │ ├─TableReader 9990.00 root data:Selection", - " │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t4.b))", - " │ │ └─TableFullScan 10000.00 cop[tikv] table:t4, partition:p2 keep order:false, stats:pseudo", - " │ └─TableReader 9990.00 root data:Selection", - " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t4.b))", - " │ └─TableFullScan 10000.00 cop[tikv] table:t4, partition:p3 keep order:false, stats:pseudo", - " └─PartitionUnion(Probe) 49900.05 root ", - " ├─TableReader 9980.01 root data:Selection", - " │ └─Selection 9980.01 cop[tikv] not(isnull(test.t2.a)), not(isnull(test.t2.b))", - " │ └─TableFullScan 10000.00 cop[tikv] table:t2, partition:p0 keep order:false, stats:pseudo", - " ├─TableReader 9980.01 root data:Selection", - " │ └─Selection 9980.01 cop[tikv] not(isnull(test.t2.a)), not(isnull(test.t2.b))", - " │ └─TableFullScan 10000.00 cop[tikv] table:t2, partition:p1 keep order:false, stats:pseudo", - " ├─TableReader 9980.01 root data:Selection", - " │ └─Selection 9980.01 cop[tikv] not(isnull(test.t2.a)), not(isnull(test.t2.b))", - " │ └─TableFullScan 10000.00 cop[tikv] table:t2, partition:p2 keep order:false, stats:pseudo", - " ├─TableReader 9980.01 root data:Selection", - " │ └─Selection 9980.01 cop[tikv] not(isnull(test.t2.a)), not(isnull(test.t2.b))", - " │ └─TableFullScan 10000.00 cop[tikv] table:t2, partition:p3 keep order:false, stats:pseudo", - " └─TableReader 9980.01 root data:Selection", - " └─Selection 9980.01 cop[tikv] not(isnull(test.t2.a)), not(isnull(test.t2.b))", - " └─TableFullScan 10000.00 cop[tikv] table:t2, partition:p4 keep order:false, stats:pseudo" + " ├─PartitionUnion(Build) 49900.05 root ", + " │ ├─TableReader 9980.01 root data:Selection", + " │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t2.a)), not(isnull(test.t2.b))", + " │ │ └─TableFullScan 10000.00 cop[tikv] table:t2, partition:p0 keep order:false, stats:pseudo", + " │ ├─TableReader 9980.01 root data:Selection", + " │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t2.a)), not(isnull(test.t2.b))", + " │ │ └─TableFullScan 10000.00 cop[tikv] table:t2, partition:p1 keep order:false, stats:pseudo", + " │ ├─TableReader 9980.01 root data:Selection", + " │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t2.a)), not(isnull(test.t2.b))", + " │ │ └─TableFullScan 10000.00 cop[tikv] table:t2, partition:p2 keep order:false, stats:pseudo", + " │ ├─TableReader 9980.01 root data:Selection", + " │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t2.a)), not(isnull(test.t2.b))", + " │ │ └─TableFullScan 10000.00 cop[tikv] table:t2, partition:p3 keep order:false, stats:pseudo", + " │ └─TableReader 9980.01 root data:Selection", + " │ └─Selection 9980.01 cop[tikv] not(isnull(test.t2.a)), not(isnull(test.t2.b))", + " │ └─TableFullScan 10000.00 cop[tikv] table:t2, partition:p4 keep order:false, stats:pseudo", + " └─HashJoin(Probe) 46781.30 root inner join, equal:[eq(test.t3.b, test.t4.b)]", + " ├─HashJoin(Build) 37425.04 root inner join, equal:[eq(test.t3.a, test.t1.a)]", + " │ ├─PartitionUnion(Build) 29940.03 root ", + " │ │ ├─TableReader 9980.01 root data:Selection", + " │ │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t3.a)), not(isnull(test.t3.b))", + " │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t3, partition:p0 keep order:false, stats:pseudo", + " │ │ ├─TableReader 9980.01 root data:Selection", + " │ │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t3.a)), not(isnull(test.t3.b))", + " │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t3, partition:p1 keep order:false, stats:pseudo", + " │ │ └─TableReader 9980.01 root data:Selection", + " │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t3.a)), not(isnull(test.t3.b))", + " │ │ └─TableFullScan 10000.00 cop[tikv] table:t3, partition:p2 keep order:false, stats:pseudo", + " │ └─PartitionUnion(Probe) 39920.04 root ", + " │ ├─TableReader 9980.01 root data:Selection", + " │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t1.a)), not(isnull(test.t1.b))", + " │ │ └─TableFullScan 10000.00 cop[tikv] table:t1, partition:p0 keep order:false, stats:pseudo", + " │ ├─TableReader 9980.01 root data:Selection", + " │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t1.a)), not(isnull(test.t1.b))", + " │ │ └─TableFullScan 10000.00 cop[tikv] table:t1, partition:p1 keep order:false, stats:pseudo", + " │ ├─TableReader 9980.01 root data:Selection", + " │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t1.a)), not(isnull(test.t1.b))", + " │ │ └─TableFullScan 10000.00 cop[tikv] table:t1, partition:p2 keep order:false, stats:pseudo", + " │ └─TableReader 9980.01 root data:Selection", + " │ └─Selection 9980.01 cop[tikv] not(isnull(test.t1.a)), not(isnull(test.t1.b))", + " │ └─TableFullScan 10000.00 cop[tikv] table:t1, partition:p3 keep order:false, stats:pseudo", + " └─PartitionUnion(Probe) 39960.00 root ", + " ├─TableReader 9990.00 root data:Selection", + " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t4.b))", + " │ └─TableFullScan 10000.00 cop[tikv] table:t4, partition:p0 keep order:false, stats:pseudo", + " ├─TableReader 9990.00 root data:Selection", + " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t4.b))", + " │ └─TableFullScan 10000.00 cop[tikv] table:t4, partition:p1 keep order:false, stats:pseudo", + " ├─TableReader 9990.00 root data:Selection", + " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t4.b))", + " │ └─TableFullScan 10000.00 cop[tikv] table:t4, partition:p2 keep order:false, stats:pseudo", + " └─TableReader 9990.00 root data:Selection", + " └─Selection 9990.00 cop[tikv] not(isnull(test.t4.b))", + " └─TableFullScan 10000.00 cop[tikv] table:t4, partition:p3 keep order:false, stats:pseudo" ], "Warning": [ "Warning 1815 leading hint is inapplicable, check if the leading hint table is valid" @@ -3951,60 +3951,60 @@ " │ └─Selection 9980.01 cop[tikv] not(isnull(test.t5.a)), not(isnull(test.t5.b))", " │ └─TableFullScan 10000.00 cop[tikv] table:t5, partition:p4 keep order:false, stats:pseudo", " └─HashJoin(Probe) 58476.62 root inner join, equal:[eq(test.t1.b, test.t2.b)]", - " ├─HashJoin(Build) 46781.30 root inner join, equal:[eq(test.t3.b, test.t4.b)]", - " │ ├─HashJoin(Build) 37425.04 root inner join, equal:[eq(test.t3.a, test.t1.a)]", - " │ │ ├─PartitionUnion(Build) 29940.03 root ", - " │ │ │ ├─TableReader 9980.01 root data:Selection", - " │ │ │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t3.a)), not(isnull(test.t3.b))", - " │ │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t3, partition:p0 keep order:false, stats:pseudo", - " │ │ │ ├─TableReader 9980.01 root data:Selection", - " │ │ │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t3.a)), not(isnull(test.t3.b))", - " │ │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t3, partition:p1 keep order:false, stats:pseudo", - " │ │ │ └─TableReader 9980.01 root data:Selection", - " │ │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t3.a)), not(isnull(test.t3.b))", - " │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t3, partition:p2 keep order:false, stats:pseudo", - " │ │ └─PartitionUnion(Probe) 39920.04 root ", - " │ │ ├─TableReader 9980.01 root data:Selection", - " │ │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t1.a)), not(isnull(test.t1.b))", - " │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1, partition:p0 keep order:false, stats:pseudo", - " │ │ ├─TableReader 9980.01 root data:Selection", - " │ │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t1.a)), not(isnull(test.t1.b))", - " │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1, partition:p1 keep order:false, stats:pseudo", - " │ │ ├─TableReader 9980.01 root data:Selection", - " │ │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t1.a)), not(isnull(test.t1.b))", - " │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1, partition:p2 keep order:false, stats:pseudo", - " │ │ └─TableReader 9980.01 root data:Selection", - " │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t1.a)), not(isnull(test.t1.b))", - " │ │ └─TableFullScan 10000.00 cop[tikv] table:t1, partition:p3 keep order:false, stats:pseudo", - " │ └─PartitionUnion(Probe) 39960.00 root ", - " │ ├─TableReader 9990.00 root data:Selection", - " │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t4.b))", - " │ │ └─TableFullScan 10000.00 cop[tikv] table:t4, partition:p0 keep order:false, stats:pseudo", - " │ ├─TableReader 9990.00 root data:Selection", - " │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t4.b))", - " │ │ └─TableFullScan 10000.00 cop[tikv] table:t4, partition:p1 keep order:false, stats:pseudo", - " │ ├─TableReader 9990.00 root data:Selection", - " │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t4.b))", - " │ │ └─TableFullScan 10000.00 cop[tikv] table:t4, partition:p2 keep order:false, stats:pseudo", - " │ └─TableReader 9990.00 root data:Selection", - " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t4.b))", - " │ └─TableFullScan 10000.00 cop[tikv] table:t4, partition:p3 keep order:false, stats:pseudo", - " └─PartitionUnion(Probe) 49900.05 root ", - " ├─TableReader 9980.01 root data:Selection", - " │ └─Selection 9980.01 cop[tikv] not(isnull(test.t2.a)), not(isnull(test.t2.b))", - " │ └─TableFullScan 10000.00 cop[tikv] table:t2, partition:p0 keep order:false, stats:pseudo", - " ├─TableReader 9980.01 root data:Selection", - " │ └─Selection 9980.01 cop[tikv] not(isnull(test.t2.a)), not(isnull(test.t2.b))", - " │ └─TableFullScan 10000.00 cop[tikv] table:t2, partition:p1 keep order:false, stats:pseudo", - " ├─TableReader 9980.01 root data:Selection", - " │ └─Selection 9980.01 cop[tikv] not(isnull(test.t2.a)), not(isnull(test.t2.b))", - " │ └─TableFullScan 10000.00 cop[tikv] table:t2, partition:p2 keep order:false, stats:pseudo", - " ├─TableReader 9980.01 root data:Selection", - " │ └─Selection 9980.01 cop[tikv] not(isnull(test.t2.a)), not(isnull(test.t2.b))", - " │ └─TableFullScan 10000.00 cop[tikv] table:t2, partition:p3 keep order:false, stats:pseudo", - " └─TableReader 9980.01 root data:Selection", - " └─Selection 9980.01 cop[tikv] not(isnull(test.t2.a)), not(isnull(test.t2.b))", - " └─TableFullScan 10000.00 cop[tikv] table:t2, partition:p4 keep order:false, stats:pseudo" + " ├─PartitionUnion(Build) 49900.05 root ", + " │ ├─TableReader 9980.01 root data:Selection", + " │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t2.a)), not(isnull(test.t2.b))", + " │ │ └─TableFullScan 10000.00 cop[tikv] table:t2, partition:p0 keep order:false, stats:pseudo", + " │ ├─TableReader 9980.01 root data:Selection", + " │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t2.a)), not(isnull(test.t2.b))", + " │ │ └─TableFullScan 10000.00 cop[tikv] table:t2, partition:p1 keep order:false, stats:pseudo", + " │ ├─TableReader 9980.01 root data:Selection", + " │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t2.a)), not(isnull(test.t2.b))", + " │ │ └─TableFullScan 10000.00 cop[tikv] table:t2, partition:p2 keep order:false, stats:pseudo", + " │ ├─TableReader 9980.01 root data:Selection", + " │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t2.a)), not(isnull(test.t2.b))", + " │ │ └─TableFullScan 10000.00 cop[tikv] table:t2, partition:p3 keep order:false, stats:pseudo", + " │ └─TableReader 9980.01 root data:Selection", + " │ └─Selection 9980.01 cop[tikv] not(isnull(test.t2.a)), not(isnull(test.t2.b))", + " │ └─TableFullScan 10000.00 cop[tikv] table:t2, partition:p4 keep order:false, stats:pseudo", + " └─HashJoin(Probe) 46781.30 root inner join, equal:[eq(test.t3.b, test.t4.b)]", + " ├─HashJoin(Build) 37425.04 root inner join, equal:[eq(test.t3.a, test.t1.a)]", + " │ ├─PartitionUnion(Build) 29940.03 root ", + " │ │ ├─TableReader 9980.01 root data:Selection", + " │ │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t3.a)), not(isnull(test.t3.b))", + " │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t3, partition:p0 keep order:false, stats:pseudo", + " │ │ ├─TableReader 9980.01 root data:Selection", + " │ │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t3.a)), not(isnull(test.t3.b))", + " │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t3, partition:p1 keep order:false, stats:pseudo", + " │ │ └─TableReader 9980.01 root data:Selection", + " │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t3.a)), not(isnull(test.t3.b))", + " │ │ └─TableFullScan 10000.00 cop[tikv] table:t3, partition:p2 keep order:false, stats:pseudo", + " │ └─PartitionUnion(Probe) 39920.04 root ", + " │ ├─TableReader 9980.01 root data:Selection", + " │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t1.a)), not(isnull(test.t1.b))", + " │ │ └─TableFullScan 10000.00 cop[tikv] table:t1, partition:p0 keep order:false, stats:pseudo", + " │ ├─TableReader 9980.01 root data:Selection", + " │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t1.a)), not(isnull(test.t1.b))", + " │ │ └─TableFullScan 10000.00 cop[tikv] table:t1, partition:p1 keep order:false, stats:pseudo", + " │ ├─TableReader 9980.01 root data:Selection", + " │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t1.a)), not(isnull(test.t1.b))", + " │ │ └─TableFullScan 10000.00 cop[tikv] table:t1, partition:p2 keep order:false, stats:pseudo", + " │ └─TableReader 9980.01 root data:Selection", + " │ └─Selection 9980.01 cop[tikv] not(isnull(test.t1.a)), not(isnull(test.t1.b))", + " │ └─TableFullScan 10000.00 cop[tikv] table:t1, partition:p3 keep order:false, stats:pseudo", + " └─PartitionUnion(Probe) 39960.00 root ", + " ├─TableReader 9990.00 root data:Selection", + " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t4.b))", + " │ └─TableFullScan 10000.00 cop[tikv] table:t4, partition:p0 keep order:false, stats:pseudo", + " ├─TableReader 9990.00 root data:Selection", + " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t4.b))", + " │ └─TableFullScan 10000.00 cop[tikv] table:t4, partition:p1 keep order:false, stats:pseudo", + " ├─TableReader 9990.00 root data:Selection", + " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t4.b))", + " │ └─TableFullScan 10000.00 cop[tikv] table:t4, partition:p2 keep order:false, stats:pseudo", + " └─TableReader 9990.00 root data:Selection", + " └─Selection 9990.00 cop[tikv] not(isnull(test.t4.b))", + " └─TableFullScan 10000.00 cop[tikv] table:t4, partition:p3 keep order:false, stats:pseudo" ], "Warning": [ "Warning 1815 We can only use one leading hint at most, when multiple leading hints are used, all leading hints will be invalid" @@ -4043,60 +4043,60 @@ " │ └─Selection 9980.01 cop[tikv] not(isnull(test.t5.a)), not(isnull(test.t5.b))", " │ └─TableFullScan 10000.00 cop[tikv] table:t5, partition:p4 keep order:false, stats:pseudo", " └─HashJoin(Probe) 58476.62 root inner join, equal:[eq(test.t1.b, test.t2.b)]", - " ├─HashJoin(Build) 46781.30 root inner join, equal:[eq(test.t3.b, test.t4.b)]", - " │ ├─HashJoin(Build) 37425.04 root inner join, equal:[eq(test.t3.a, test.t1.a)]", - " │ │ ├─PartitionUnion(Build) 29940.03 root ", - " │ │ │ ├─TableReader 9980.01 root data:Selection", - " │ │ │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t3.a)), not(isnull(test.t3.b))", - " │ │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t3, partition:p0 keep order:false, stats:pseudo", - " │ │ │ ├─TableReader 9980.01 root data:Selection", - " │ │ │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t3.a)), not(isnull(test.t3.b))", - " │ │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t3, partition:p1 keep order:false, stats:pseudo", - " │ │ │ └─TableReader 9980.01 root data:Selection", - " │ │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t3.a)), not(isnull(test.t3.b))", - " │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t3, partition:p2 keep order:false, stats:pseudo", - " │ │ └─PartitionUnion(Probe) 39920.04 root ", - " │ │ ├─TableReader 9980.01 root data:Selection", - " │ │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t1.a)), not(isnull(test.t1.b))", - " │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1, partition:p0 keep order:false, stats:pseudo", - " │ │ ├─TableReader 9980.01 root data:Selection", - " │ │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t1.a)), not(isnull(test.t1.b))", - " │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1, partition:p1 keep order:false, stats:pseudo", - " │ │ ├─TableReader 9980.01 root data:Selection", - " │ │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t1.a)), not(isnull(test.t1.b))", - " │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1, partition:p2 keep order:false, stats:pseudo", - " │ │ └─TableReader 9980.01 root data:Selection", - " │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t1.a)), not(isnull(test.t1.b))", - " │ │ └─TableFullScan 10000.00 cop[tikv] table:t1, partition:p3 keep order:false, stats:pseudo", - " │ └─PartitionUnion(Probe) 39960.00 root ", - " │ ├─TableReader 9990.00 root data:Selection", - " │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t4.b))", - " │ │ └─TableFullScan 10000.00 cop[tikv] table:t4, partition:p0 keep order:false, stats:pseudo", - " │ ├─TableReader 9990.00 root data:Selection", - " │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t4.b))", - " │ │ └─TableFullScan 10000.00 cop[tikv] table:t4, partition:p1 keep order:false, stats:pseudo", - " │ ├─TableReader 9990.00 root data:Selection", - " │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t4.b))", - " │ │ └─TableFullScan 10000.00 cop[tikv] table:t4, partition:p2 keep order:false, stats:pseudo", - " │ └─TableReader 9990.00 root data:Selection", - " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t4.b))", - " │ └─TableFullScan 10000.00 cop[tikv] table:t4, partition:p3 keep order:false, stats:pseudo", - " └─PartitionUnion(Probe) 49900.05 root ", - " ├─TableReader 9980.01 root data:Selection", - " │ └─Selection 9980.01 cop[tikv] not(isnull(test.t2.a)), not(isnull(test.t2.b))", - " │ └─TableFullScan 10000.00 cop[tikv] table:t2, partition:p0 keep order:false, stats:pseudo", - " ├─TableReader 9980.01 root data:Selection", - " │ └─Selection 9980.01 cop[tikv] not(isnull(test.t2.a)), not(isnull(test.t2.b))", - " │ └─TableFullScan 10000.00 cop[tikv] table:t2, partition:p1 keep order:false, stats:pseudo", - " ├─TableReader 9980.01 root data:Selection", - " │ └─Selection 9980.01 cop[tikv] not(isnull(test.t2.a)), not(isnull(test.t2.b))", - " │ └─TableFullScan 10000.00 cop[tikv] table:t2, partition:p2 keep order:false, stats:pseudo", - " ├─TableReader 9980.01 root data:Selection", - " │ └─Selection 9980.01 cop[tikv] not(isnull(test.t2.a)), not(isnull(test.t2.b))", - " │ └─TableFullScan 10000.00 cop[tikv] table:t2, partition:p3 keep order:false, stats:pseudo", - " └─TableReader 9980.01 root data:Selection", - " └─Selection 9980.01 cop[tikv] not(isnull(test.t2.a)), not(isnull(test.t2.b))", - " └─TableFullScan 10000.00 cop[tikv] table:t2, partition:p4 keep order:false, stats:pseudo" + " ├─PartitionUnion(Build) 49900.05 root ", + " │ ├─TableReader 9980.01 root data:Selection", + " │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t2.a)), not(isnull(test.t2.b))", + " │ │ └─TableFullScan 10000.00 cop[tikv] table:t2, partition:p0 keep order:false, stats:pseudo", + " │ ├─TableReader 9980.01 root data:Selection", + " │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t2.a)), not(isnull(test.t2.b))", + " │ │ └─TableFullScan 10000.00 cop[tikv] table:t2, partition:p1 keep order:false, stats:pseudo", + " │ ├─TableReader 9980.01 root data:Selection", + " │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t2.a)), not(isnull(test.t2.b))", + " │ │ └─TableFullScan 10000.00 cop[tikv] table:t2, partition:p2 keep order:false, stats:pseudo", + " │ ├─TableReader 9980.01 root data:Selection", + " │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t2.a)), not(isnull(test.t2.b))", + " │ │ └─TableFullScan 10000.00 cop[tikv] table:t2, partition:p3 keep order:false, stats:pseudo", + " │ └─TableReader 9980.01 root data:Selection", + " │ └─Selection 9980.01 cop[tikv] not(isnull(test.t2.a)), not(isnull(test.t2.b))", + " │ └─TableFullScan 10000.00 cop[tikv] table:t2, partition:p4 keep order:false, stats:pseudo", + " └─HashJoin(Probe) 46781.30 root inner join, equal:[eq(test.t3.b, test.t4.b)]", + " ├─HashJoin(Build) 37425.04 root inner join, equal:[eq(test.t3.a, test.t1.a)]", + " │ ├─PartitionUnion(Build) 29940.03 root ", + " │ │ ├─TableReader 9980.01 root data:Selection", + " │ │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t3.a)), not(isnull(test.t3.b))", + " │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t3, partition:p0 keep order:false, stats:pseudo", + " │ │ ├─TableReader 9980.01 root data:Selection", + " │ │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t3.a)), not(isnull(test.t3.b))", + " │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t3, partition:p1 keep order:false, stats:pseudo", + " │ │ └─TableReader 9980.01 root data:Selection", + " │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t3.a)), not(isnull(test.t3.b))", + " │ │ └─TableFullScan 10000.00 cop[tikv] table:t3, partition:p2 keep order:false, stats:pseudo", + " │ └─PartitionUnion(Probe) 39920.04 root ", + " │ ├─TableReader 9980.01 root data:Selection", + " │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t1.a)), not(isnull(test.t1.b))", + " │ │ └─TableFullScan 10000.00 cop[tikv] table:t1, partition:p0 keep order:false, stats:pseudo", + " │ ├─TableReader 9980.01 root data:Selection", + " │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t1.a)), not(isnull(test.t1.b))", + " │ │ └─TableFullScan 10000.00 cop[tikv] table:t1, partition:p1 keep order:false, stats:pseudo", + " │ ├─TableReader 9980.01 root data:Selection", + " │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t1.a)), not(isnull(test.t1.b))", + " │ │ └─TableFullScan 10000.00 cop[tikv] table:t1, partition:p2 keep order:false, stats:pseudo", + " │ └─TableReader 9980.01 root data:Selection", + " │ └─Selection 9980.01 cop[tikv] not(isnull(test.t1.a)), not(isnull(test.t1.b))", + " │ └─TableFullScan 10000.00 cop[tikv] table:t1, partition:p3 keep order:false, stats:pseudo", + " └─PartitionUnion(Probe) 39960.00 root ", + " ├─TableReader 9990.00 root data:Selection", + " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t4.b))", + " │ └─TableFullScan 10000.00 cop[tikv] table:t4, partition:p0 keep order:false, stats:pseudo", + " ├─TableReader 9990.00 root data:Selection", + " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t4.b))", + " │ └─TableFullScan 10000.00 cop[tikv] table:t4, partition:p1 keep order:false, stats:pseudo", + " ├─TableReader 9990.00 root data:Selection", + " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t4.b))", + " │ └─TableFullScan 10000.00 cop[tikv] table:t4, partition:p2 keep order:false, stats:pseudo", + " └─TableReader 9990.00 root data:Selection", + " └─Selection 9990.00 cop[tikv] not(isnull(test.t4.b))", + " └─TableFullScan 10000.00 cop[tikv] table:t4, partition:p3 keep order:false, stats:pseudo" ], "Warning": [ "Warning 1815 leading hint is inapplicable, check if the leading hint table is valid" diff --git a/planner/core/testdata/plan_suite_out.json b/planner/core/testdata/plan_suite_out.json index 43a23f6cf075f..a5802be47dc1c 100644 --- a/planner/core/testdata/plan_suite_out.json +++ b/planner/core/testdata/plan_suite_out.json @@ -108,11 +108,11 @@ }, { "SQL": "select /*+ INL_JOIN(t1) */ t1.a, t1.b from t t1, (select t2.a from t t2, t t3 where t2.a = t3.c) s where t1.a=s.a", - "Best": "IndexJoin{TableReader(Table(t))->LeftHashJoin{IndexReader(Index(t.f)[[NULL,+inf]])->IndexReader(Index(t.c_d_e)[[NULL,+inf]])}(test.t.a,test.t.c)}(test.t.a,test.t.a)" + "Best": "IndexJoin{TableReader(Table(t))->MergeInnerJoin{TableReader(Table(t))->IndexReader(Index(t.c_d_e)[[NULL,+inf]])}(test.t.a,test.t.c)}(test.t.a,test.t.a)" }, { "SQL": "select /*+ HASH_JOIN(t1) */ t1.a, t1.b from t t1, (select t2.a from t t2, t t3 where t2.a = t3.c) s where t1.a=s.a", - "Best": "RightHashJoin{TableReader(Table(t))->LeftHashJoin{IndexReader(Index(t.f)[[NULL,+inf]])->IndexReader(Index(t.c_d_e)[[NULL,+inf]])}(test.t.a,test.t.c)}(test.t.a,test.t.a)" + "Best": "RightHashJoin{TableReader(Table(t))->MergeInnerJoin{TableReader(Table(t))->IndexReader(Index(t.c_d_e)[[NULL,+inf]])}(test.t.a,test.t.c)}(test.t.a,test.t.a)" }, { "SQL": "select /*+ HASH_JOIN(@sel_2 t1@sel_2, t2@sel_2), MERGE_JOIN(@sel_1 t1@sel_1, t2@sel_1) */ * from (select t1.a, t1.b from t t1, t t2 where t1.a = t2.a) t1, t t2 where t1.b = t2.b", @@ -538,7 +538,7 @@ }, { "SQL": "select * from t t1 join t t2 on t1.a = t2.a join t t3 on t1.a = t3.a", - "Best": "LeftHashJoin{MergeInnerJoin{TableReader(Table(t))->TableReader(Table(t))}(test.t.a,test.t.a)->TableReader(Table(t))}(test.t.a,test.t.a)" + "Best": "MergeInnerJoin{MergeInnerJoin{TableReader(Table(t))->TableReader(Table(t))}(test.t.a,test.t.a)->TableReader(Table(t))}(test.t.a,test.t.a)" }, { "SQL": "select * from t t1 join t t2 on t1.a = t2.a join t t3 on t1.b = t3.a", @@ -546,7 +546,7 @@ }, { "SQL": "select * from t t1 join t t2 on t1.b = t2.a order by t1.a", - "Best": "IndexJoin{TableReader(Table(t))->TableReader(Table(t))}(test.t.b,test.t.a)" + "Best": "LeftHashJoin{TableReader(Table(t))->TableReader(Table(t))}(test.t.b,test.t.a)->Sort" }, { "SQL": "select * from t t1 join t t2 on t1.b = t2.a order by t1.a limit 1", @@ -574,7 +574,7 @@ }, { "SQL": "select * from t t1 left outer join t t2 on t1.a = t2.a right outer join t t3 on t1.a = t3.a", - "Best": "RightHashJoin{MergeLeftOuterJoin{TableReader(Table(t))->TableReader(Table(t))}(test.t.a,test.t.a)->TableReader(Table(t))}(test.t.a,test.t.a)" + "Best": "MergeRightOuterJoin{MergeLeftOuterJoin{TableReader(Table(t))->TableReader(Table(t))}(test.t.a,test.t.a)->TableReader(Table(t))}(test.t.a,test.t.a)" }, { "SQL": "select * from t t1 join t t2 on t1.a = t2.a join t t3 on t1.a = t3.a and t1.b = 1 and t3.c = 1", @@ -678,7 +678,7 @@ }, { "SQL": "select /*+ TIDB_INLJ(t2) */ * from t t1 where t1.a in (select a from t t2)", - "Best": "LeftHashJoin{TableReader(Table(t))->IndexReader(Index(t.f)[[NULL,+inf]])}(test.t.a,test.t.a)" + "Best": "MergeInnerJoin{TableReader(Table(t))->TableReader(Table(t))}(test.t.a,test.t.a)" }, { "SQL": "select /*+ TIDB_INLJ(t1) */ * from t t1 where t1.a in (select a from t t2)", @@ -743,7 +743,7 @@ }, { "SQL": "select * from t where a in (select a from t) order by b", - "Best": "LeftHashJoin{TableReader(Table(t))->IndexReader(Index(t.f)[[NULL,+inf]])}(test.t.a,test.t.a)->Sort" + "Best": "MergeInnerJoin{TableReader(Table(t))->TableReader(Table(t))}(test.t.a,test.t.a)->Sort" }, { "SQL": "select t.c in (select count(*) from t s, t t1 where s.a = t.a and s.a = t1.a) from t", @@ -751,7 +751,7 @@ }, { "SQL": "select (select count(*) from t s, t t1 where s.a = t.a and s.a = t1.a) from t", - "Best": "LeftHashJoin{IndexReader(Index(t.f)[[NULL,+inf]])->LeftHashJoin{IndexReader(Index(t.f)[[NULL,+inf]])->IndexReader(Index(t.f)[[NULL,+inf]])}(test.t.a,test.t.a)->Projection}(test.t.a,test.t.a)->Projection" + "Best": "MergeLeftOuterJoin{TableReader(Table(t))->MergeInnerJoin{TableReader(Table(t))->TableReader(Table(t))}(test.t.a,test.t.a)->Projection}(test.t.a,test.t.a)->Projection" }, { "SQL": "select (select count(*) from t s, t t1 where s.a = t.a and s.a = t1.a) from t order by t.a", @@ -2422,13 +2422,13 @@ "HashAgg 16000.00 root group by:Column#5, funcs:firstrow(Column#6)->Column#3", "└─PartitionUnion 16000.00 root ", " ├─HashAgg 8000.00 root group by:Column#7, funcs:firstrow(Column#7)->Column#6, funcs:firstrow(Column#7)->Column#5", - " │ └─TableReader 8000.00 root data:HashAgg", + " │ └─IndexReader 8000.00 root index:HashAgg", " │ └─HashAgg 8000.00 cop[tikv] group by:date_format(test.tc.timestamp, \"%Y-%m-%d %H\"), ", - " │ └─TableFullScan 10000.00 cop[tikv] table:tc, partition:p2020072312 keep order:false, stats:pseudo", + " │ └─IndexFullScan 10000.00 cop[tikv] table:tc, partition:p2020072312, index:idx_timestamp(timestamp) keep order:false, stats:pseudo", " └─HashAgg 8000.00 root group by:Column#10, funcs:firstrow(Column#10)->Column#6, funcs:firstrow(Column#10)->Column#5", - " └─TableReader 8000.00 root data:HashAgg", + " └─IndexReader 8000.00 root index:HashAgg", " └─HashAgg 8000.00 cop[tikv] group by:date_format(test.tc.timestamp, \"%Y-%m-%d %H\"), ", - " └─TableFullScan 10000.00 cop[tikv] table:tc, partition:p2020072313 keep order:false, stats:pseudo" + " └─IndexFullScan 10000.00 cop[tikv] table:tc, partition:p2020072313, index:idx_timestamp(timestamp) keep order:false, stats:pseudo" ], "Result": null } @@ -2605,13 +2605,13 @@ "HashAgg 16000.00 root group by:Column#5, funcs:firstrow(Column#6)->Column#3", "└─PartitionUnion 16000.00 root ", " ├─HashAgg 8000.00 root group by:Column#7, funcs:firstrow(Column#7)->Column#6, funcs:firstrow(Column#7)->Column#5", - " │ └─TableReader 8000.00 root data:HashAgg", + " │ └─IndexReader 8000.00 root index:HashAgg", " │ └─HashAgg 8000.00 cop[tikv] group by:date_format(test.tc.timestamp, \"%Y-%m-%d %H\"), ", - " │ └─TableFullScan 10000.00 cop[tikv] table:tc, partition:p2020072312 keep order:false, stats:pseudo", + " │ └─IndexFullScan 10000.00 cop[tikv] table:tc, partition:p2020072312, index:idx_timestamp(timestamp) keep order:false, stats:pseudo", " └─HashAgg 8000.00 root group by:Column#10, funcs:firstrow(Column#10)->Column#6, funcs:firstrow(Column#10)->Column#5", - " └─TableReader 8000.00 root data:HashAgg", + " └─IndexReader 8000.00 root index:HashAgg", " └─HashAgg 8000.00 cop[tikv] group by:date_format(test.tc.timestamp, \"%Y-%m-%d %H\"), ", - " └─TableFullScan 10000.00 cop[tikv] table:tc, partition:p2020072313 keep order:false, stats:pseudo" + " └─IndexFullScan 10000.00 cop[tikv] table:tc, partition:p2020072313, index:idx_timestamp(timestamp) keep order:false, stats:pseudo" ], "Result": null } @@ -3467,19 +3467,18 @@ { "SQL": "select count(distinct a) from (select count(distinct deptid) a from employee) x", "Plan": [ - "TableReader 1.00 root data:ExchangeSender", - "└─ExchangeSender 1.00 mpp[tiflash] ExchangeType: PassThrough", - " └─Projection 1.00 mpp[tiflash] Column#6", - " └─HashAgg 1.00 mpp[tiflash] funcs:count(distinct Column#5)->Column#6", - " └─Projection 1.00 mpp[tiflash] Column#5", - " └─HashAgg 1.00 mpp[tiflash] funcs:sum(Column#8)->Column#5", - " └─ExchangeReceiver 1.00 mpp[tiflash] ", - " └─ExchangeSender 1.00 mpp[tiflash] ExchangeType: PassThrough", - " └─HashAgg 1.00 mpp[tiflash] funcs:count(distinct test.employee.deptid)->Column#8", - " └─ExchangeReceiver 1.00 mpp[tiflash] ", - " └─ExchangeSender 1.00 mpp[tiflash] ExchangeType: HashPartition, Hash Cols: [name: test.employee.deptid, collate: binary]", - " └─HashAgg 1.00 mpp[tiflash] group by:test.employee.deptid, ", - " └─TableFullScan 10000.00 mpp[tiflash] table:employee keep order:false, stats:pseudo" + "StreamAgg 1.00 root funcs:count(distinct Column#5)->Column#6", + "└─TableReader 1.00 root data:ExchangeSender", + " └─ExchangeSender 1.00 mpp[tiflash] ExchangeType: PassThrough", + " └─Projection 1.00 mpp[tiflash] Column#5", + " └─HashAgg 1.00 mpp[tiflash] funcs:sum(Column#7)->Column#5", + " └─ExchangeReceiver 1.00 mpp[tiflash] ", + " └─ExchangeSender 1.00 mpp[tiflash] ExchangeType: PassThrough", + " └─HashAgg 1.00 mpp[tiflash] funcs:count(distinct test.employee.deptid)->Column#7", + " └─ExchangeReceiver 1.00 mpp[tiflash] ", + " └─ExchangeSender 1.00 mpp[tiflash] ExchangeType: HashPartition, Hash Cols: [name: test.employee.deptid, collate: binary]", + " └─HashAgg 1.00 mpp[tiflash] group by:test.employee.deptid, ", + " └─TableFullScan 10000.00 mpp[tiflash] table:employee keep order:false, stats:pseudo" ] }, { diff --git a/statistics/integration_test.go b/statistics/integration_test.go index c4e4d315c7dbe..a94a029f86381 100644 --- a/statistics/integration_test.go +++ b/statistics/integration_test.go @@ -268,6 +268,7 @@ func TestExpBackoffEstimation(t *testing.T) { store := testkit.CreateMockStore(t) tk := testkit.NewTestKit(t, store) tk.MustExec("use test") + tk.MustExec("set tidb_cost_model_version=2") tk.MustExec("create table exp_backoff(a int, b int, c int, d int, index idx(a, b, c, d))") tk.MustExec("insert into exp_backoff values(1, 1, 1, 1), (1, 1, 1, 2), (1, 1, 2, 3), (1, 2, 2, 4), (1, 2, 3, 5)") tk.MustExec("set @@session.tidb_analyze_version=2") diff --git a/statistics/testdata/integration_suite_out.json b/statistics/testdata/integration_suite_out.json index 9e39d3c7d2052..2a150a0f44159 100644 --- a/statistics/testdata/integration_suite_out.json +++ b/statistics/testdata/integration_suite_out.json @@ -7,27 +7,27 @@ "└─IndexRangeScan_5 5.00 cop[tikv] table:exp_backoff, index:idx(a, b, c, d) range:[1,1], keep order:false" ], [ - "TableReader_7 3.00 root data:Selection_6", - "└─Selection_6 3.00 cop[tikv] eq(test.exp_backoff.b, 1)", - " └─TableFullScan_5 5.00 cop[tikv] table:exp_backoff keep order:false" + "IndexReader_10 3.00 root index:Selection_9", + "└─Selection_9 3.00 cop[tikv] eq(test.exp_backoff.b, 1)", + " └─IndexFullScan_8 5.00 cop[tikv] table:exp_backoff, index:idx(a, b, c, d) keep order:false" ], [ - "TableReader_7 2.00 root data:Selection_6", - "└─Selection_6 2.00 cop[tikv] eq(test.exp_backoff.c, 1)", - " └─TableFullScan_5 5.00 cop[tikv] table:exp_backoff keep order:false" + "IndexReader_10 2.00 root index:Selection_9", + "└─Selection_9 2.00 cop[tikv] eq(test.exp_backoff.c, 1)", + " └─IndexFullScan_8 5.00 cop[tikv] table:exp_backoff, index:idx(a, b, c, d) keep order:false" ], [ - "TableReader_7 3.00 root data:Selection_6", - "└─Selection_6 3.00 cop[tikv] ge(test.exp_backoff.d, 3), le(test.exp_backoff.d, 5)", - " └─TableFullScan_5 5.00 cop[tikv] table:exp_backoff keep order:false" + "IndexReader_10 3.00 root index:Selection_9", + "└─Selection_9 3.00 cop[tikv] ge(test.exp_backoff.d, 3), le(test.exp_backoff.d, 5)", + " └─IndexFullScan_8 5.00 cop[tikv] table:exp_backoff, index:idx(a, b, c, d) keep order:false" ], [ "IndexReader_6 1.36 root index:IndexRangeScan_5", "└─IndexRangeScan_5 1.36 cop[tikv] table:exp_backoff, index:idx(a, b, c, d) range:[1 1 1 3,1 1 1 5], keep order:false" ], [ - "IndexReader_6 0.00 root index:IndexRangeScan_5", - "└─IndexRangeScan_5 0.00 cop[tikv] table:exp_backoff, index:idx(a, b, c, d) range:[1 1 1 3,1 1 1 5], keep order:false" + "IndexReader_6 1.36 root index:IndexRangeScan_5", + "└─IndexRangeScan_5 1.36 cop[tikv] table:exp_backoff, index:idx(a, b, c, d) range:[1 1 1 3,1 1 1 5], keep order:false" ] ] }, diff --git a/util/ranger/ranger_test.go b/util/ranger/ranger_test.go index 522494f447e04..74af841563b0f 100644 --- a/util/ranger/ranger_test.go +++ b/util/ranger/ranger_test.go @@ -866,6 +866,7 @@ func TestCompIndexInExprCorrCol(t *testing.T) { testKit := testkit.NewTestKit(t, store) testKit.MustExec("use test") + testKit.MustExec("set tidb_cost_model_version=2") testKit.MustExec("drop table if exists t") testKit.MustExec("create table t(a int primary key, b int, c int, d int, e int, index idx(b,c,d))") testKit.MustExec("insert into t values(1,1,1,1,2),(2,1,2,1,0)") diff --git a/util/ranger/testdata/ranger_suite_out.json b/util/ranger/testdata/ranger_suite_out.json index e4de18e162c7b..4a4f0c85e2682 100644 --- a/util/ranger/testdata/ranger_suite_out.json +++ b/util/ranger/testdata/ranger_suite_out.json @@ -11,8 +11,8 @@ " │ └─TableFullScan 2.00 cop[tikv] table:t keep order:false", " └─StreamAgg(Probe) 2.00 root funcs:count(1)->Column#26", " └─HashJoin 4.00 root inner join, equal:[eq(test.t.a, test.t.a)]", - " ├─TableReader(Build) 4.00 root data:TableFullScan", - " │ └─TableFullScan 4.00 cop[tikv] table:t1 keep order:false", + " ├─IndexReader(Build) 4.00 root index:IndexFullScan", + " │ └─IndexFullScan 4.00 cop[tikv] table:t1, index:idx(b, c, d) keep order:false", " └─IndexReader(Probe) 4.00 root index:IndexRangeScan", " └─IndexRangeScan 4.00 cop[tikv] table:s, index:idx(b, c, d) range: decided by [eq(test.t.b, 1) in(test.t.c, 1, 2) eq(test.t.d, test.t.a)], keep order:false" ] From 198f94d69bdd8d48c7bc60894f055c471ae31813 Mon Sep 17 00:00:00 2001 From: qw4990 Date: Thu, 10 Nov 2022 15:22:24 +0800 Subject: [PATCH 02/17] fixup --- executor/explain_test.go | 1 - 1 file changed, 1 deletion(-) diff --git a/executor/explain_test.go b/executor/explain_test.go index 8742b9ee011da..8c1ec9bad03a6 100644 --- a/executor/explain_test.go +++ b/executor/explain_test.go @@ -384,7 +384,6 @@ func TestCheckActRowsWithUnistore(t *testing.T) { tk.MustExec("set @@tidb_enable_chunk_rpc = on") for _, test := range tests { - fmt.Println(">>> ", test.sql) checkActRows(t, tk, test.sql, test.expected) } } From 208d4a9cfff2be67324e073aecba38a1cf7252ae Mon Sep 17 00:00:00 2001 From: qw4990 Date: Thu, 10 Nov 2022 17:39:22 +0800 Subject: [PATCH 03/17] fixup --- planner/core/plan_cost_ver2.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/planner/core/plan_cost_ver2.go b/planner/core/plan_cost_ver2.go index e6af4df396e0b..bd2cc14b320cf 100644 --- a/planner/core/plan_cost_ver2.go +++ b/planner/core/plan_cost_ver2.go @@ -116,7 +116,7 @@ func (p *PhysicalIndexScan) getPlanCostVer2(taskType property.TaskType, option * rows := getCardinality(p, option.CostFlag) rowSize := math.Max(getAvgRowSize(p.stats, p.schema.Columns), 2.0) // consider all index columns - scanFactor := getTaskScanFactorVer2(p, taskType) + scanFactor := getTaskScanFactorVer2(p, kv.TiKV, taskType) p.planCostVer2 = scanCostVer2(option, rows, rowSize, scanFactor) p.planCostInit = true @@ -139,7 +139,7 @@ func (p *PhysicalTableScan) getPlanCostVer2(taskType property.TaskType, option * rowSize = getAvgRowSize(p.stats, p.schema.Columns) } rowSize = math.Max(rowSize, 2.0) - scanFactor := getTaskScanFactorVer2(p, taskType) + scanFactor := getTaskScanFactorVer2(p, p.StoreType, taskType) p.planCostVer2 = scanCostVer2(option, rows, rowSize, scanFactor) @@ -878,10 +878,13 @@ func getTaskMemFactorVer2(p PhysicalPlan, taskType property.TaskType) costVer2Fa } } -func getTaskScanFactorVer2(p PhysicalPlan, taskType property.TaskType) costVer2Factor { +func getTaskScanFactorVer2(p PhysicalPlan, storeType kv.StoreType, taskType property.TaskType) costVer2Factor { if isTemporaryTable(getTableInfo(p)) { return defaultVer2Factors.TiDBTemp } + if storeType == kv.TiFlash { + return defaultVer2Factors.TiFlashScan + } switch taskType { case property.MppTaskType: // TiFlash return defaultVer2Factors.TiFlashScan From 8f0e0aefb55cee31205b9c51ddc6551367c5a1fd Mon Sep 17 00:00:00 2001 From: qw4990 Date: Thu, 10 Nov 2022 17:40:44 +0800 Subject: [PATCH 04/17] fixup --- planner/core/integration_test.go | 1 + 1 file changed, 1 insertion(+) diff --git a/planner/core/integration_test.go b/planner/core/integration_test.go index 9a30752a9e143..e070fbf4d4965 100644 --- a/planner/core/integration_test.go +++ b/planner/core/integration_test.go @@ -455,6 +455,7 @@ func TestSelPushDownTiFlash(t *testing.T) { tk.MustExec("set @@session.tidb_isolation_read_engines = 'tiflash'") tk.MustExec("set @@session.tidb_allow_mpp = 0") + tk.MustExec("set tidb_cost_model_version=2") var input []string var output []struct { From 7fd5e52ba0a18b30e7b7047c14985bfabefb96e2 Mon Sep 17 00:00:00 2001 From: qw4990 Date: Thu, 10 Nov 2022 17:51:05 +0800 Subject: [PATCH 05/17] fixup --- executor/tiflashtest/tiflash_test.go | 1 + 1 file changed, 1 insertion(+) diff --git a/executor/tiflashtest/tiflash_test.go b/executor/tiflashtest/tiflash_test.go index 37bcc7272575e..becdb2ec1956c 100644 --- a/executor/tiflashtest/tiflash_test.go +++ b/executor/tiflashtest/tiflash_test.go @@ -1089,6 +1089,7 @@ func TestForbidTiFlashIfExtraPhysTableIDIsNeeded(t *testing.T) { require.NoError(t, err) tk.MustExec("set tidb_partition_prune_mode=dynamic") tk.MustExec("set tidb_enforce_mpp=1") + tk.MustExec("set tidb_cost_model_version=2") rows := tk.MustQuery("explain select count(*) from t").Rows() resBuff := bytes.NewBufferString("") From 404ebb7f4f3911f772eed5abcbe418f82f901fad Mon Sep 17 00:00:00 2001 From: qw4990 Date: Fri, 11 Nov 2022 10:32:50 +0800 Subject: [PATCH 06/17] fixup --- planner/core/plan_cost_ver2.go | 4 -- .../core/testdata/enforce_mpp_suite_out.json | 9 ++-- .../core/testdata/integration_suite_out.json | 41 +++++++++---------- 3 files changed, 24 insertions(+), 30 deletions(-) diff --git a/planner/core/plan_cost_ver2.go b/planner/core/plan_cost_ver2.go index bd2cc14b320cf..81a59e904ed41 100644 --- a/planner/core/plan_cost_ver2.go +++ b/planner/core/plan_cost_ver2.go @@ -439,10 +439,6 @@ func (p *PhysicalHashAgg) getPlanCostVer2(taskType property.TaskType, option *Pl memFactor := getTaskMemFactorVer2(p, taskType) concurrency := float64(p.ctx.GetSessionVars().HashAggFinalConcurrency()) - if inputRows < 2000 { // prefer to use StreamAgg if no much data to process - inputRows = 2000 - } - aggCost := aggCostVer2(option, inputRows, p.AggFuncs, cpuFactor) groupCost := groupCostVer2(option, inputRows, p.GroupByItems, cpuFactor) hashBuildCost := hashBuildCostVer2(option, outputRows, outputRowSize, p.GroupByItems, cpuFactor, memFactor) diff --git a/planner/core/testdata/enforce_mpp_suite_out.json b/planner/core/testdata/enforce_mpp_suite_out.json index 3f8a2667a4dc2..55bf29f1b4001 100644 --- a/planner/core/testdata/enforce_mpp_suite_out.json +++ b/planner/core/testdata/enforce_mpp_suite_out.json @@ -375,10 +375,11 @@ { "SQL": "EXPLAIN SELECT count(*) from t where a=1; -- 1. static partition prune", "Plan": [ - "StreamAgg_14 1.00 root funcs:count(1)->Column#4", - "└─TableReader_39 10.00 root data:Selection_38", - " └─Selection_38 10.00 cop[tiflash] eq(test.t.a, 1)", - " └─TableFullScan_37 10000.00 cop[tiflash] table:t, partition:p0 keep order:false, stats:pseudo" + "StreamAgg_32 1.00 root funcs:count(Column#6)->Column#4", + "└─TableReader_33 1.00 root data:StreamAgg_13", + " └─StreamAgg_13 1.00 batchCop[tiflash] funcs:count(1)->Column#6", + " └─Selection_31 10.00 batchCop[tiflash] eq(test.t.a, 1)", + " └─TableFullScan_30 10000.00 batchCop[tiflash] table:t, partition:p0 keep order:false, stats:pseudo" ], "Warn": [ "MPP mode may be blocked because table `t`is a partition table which is not supported when `@@tidb_partition_prune_mode=static`." diff --git a/planner/core/testdata/integration_suite_out.json b/planner/core/testdata/integration_suite_out.json index 538b1e95c5af6..08cccff12814e 100644 --- a/planner/core/testdata/integration_suite_out.json +++ b/planner/core/testdata/integration_suite_out.json @@ -2415,8 +2415,8 @@ "Plan": [ "StreamAgg 1.00 root funcs:count(Column#6)->Column#4", "└─TableReader 1.00 root data:StreamAgg", - " └─StreamAgg 1.00 cop[tikv] funcs:count(1)->Column#6", - " └─TableFullScan 10000.00 cop[tikv] table:t31240 keep order:false, stats:pseudo" + " └─StreamAgg 1.00 batchCop[tiflash] funcs:count(1)->Column#6", + " └─TableFullScan 10000.00 batchCop[tiflash] table:t31240 keep order:false, stats:pseudo" ] }, { @@ -4733,9 +4733,9 @@ { "SQL": "desc format = 'brief' select md5(s) from t", "Plan": [ - "TableReader 10000.00 root data:Projection", - "└─Projection 10000.00 cop[tikv] md5(test.t.s)->Column#13", - " └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo" + "Projection 10000.00 root md5(test.t.s)->Column#13", + "└─TableReader 10000.00 root data:TableFullScan", + " └─TableFullScan 10000.00 cop[tiflash] table:t keep order:false, stats:pseudo" ] }, { @@ -5118,33 +5118,30 @@ { "SQL": "desc format = 'brief' select /*+ stream_agg()*/ count(b) from (select id + 1 as b from t)A", "Plan": [ - "HashAgg 1.00 root funcs:count(Column#10)->Column#6", - "└─TableReader 1.00 root data:ExchangeSender", - " └─ExchangeSender 1.00 mpp[tiflash] ExchangeType: PassThrough", - " └─HashAgg 1.00 mpp[tiflash] funcs:count(Column#11)->Column#10", - " └─Projection 10000.00 mpp[tiflash] plus(test.t.id, 1)->Column#11", - " └─TableFullScan 10000.00 mpp[tiflash] table:t keep order:false, stats:pseudo" + "StreamAgg 1.00 root funcs:count(Column#8)->Column#6", + "└─TableReader 1.00 root data:StreamAgg", + " └─StreamAgg 1.00 batchCop[tiflash] funcs:count(Column#11)->Column#8", + " └─Projection 10000.00 batchCop[tiflash] plus(test.t.id, 1)->Column#11", + " └─TableFullScan 10000.00 batchCop[tiflash] table:t keep order:false, stats:pseudo" ] }, { "SQL": "desc format = 'brief' select /*+ stream_agg()*/ count(*) from (select id + 1 as b from t)A", "Plan": [ - "HashAgg 1.00 root funcs:count(Column#9)->Column#6", - "└─TableReader 1.00 root data:ExchangeSender", - " └─ExchangeSender 1.00 mpp[tiflash] ExchangeType: PassThrough", - " └─HashAgg 1.00 mpp[tiflash] funcs:count(1)->Column#9", - " └─TableFullScan 10000.00 mpp[tiflash] table:t keep order:false, stats:pseudo" + "StreamAgg 1.00 root funcs:count(Column#7)->Column#6", + "└─TableReader 1.00 root data:StreamAgg", + " └─StreamAgg 1.00 batchCop[tiflash] funcs:count(1)->Column#7", + " └─TableFullScan 10000.00 batchCop[tiflash] table:t keep order:false, stats:pseudo" ] }, { "SQL": "desc format = 'brief' select /*+ stream_agg()*/ sum(b) from (select id + 1 as b from t)A", "Plan": [ - "HashAgg 1.00 root funcs:sum(Column#10)->Column#6", - "└─TableReader 1.00 root data:ExchangeSender", - " └─ExchangeSender 1.00 mpp[tiflash] ExchangeType: PassThrough", - " └─HashAgg 1.00 mpp[tiflash] funcs:sum(Column#11)->Column#10", - " └─Projection 10000.00 mpp[tiflash] cast(plus(test.t.id, 1), decimal(20,0) BINARY)->Column#11", - " └─TableFullScan 10000.00 mpp[tiflash] table:t keep order:false, stats:pseudo" + "StreamAgg 1.00 root funcs:sum(Column#8)->Column#6", + "└─TableReader 1.00 root data:StreamAgg", + " └─StreamAgg 1.00 batchCop[tiflash] funcs:sum(Column#11)->Column#8", + " └─Projection 10000.00 batchCop[tiflash] cast(plus(test.t.id, 1), decimal(20,0) BINARY)->Column#11", + " └─TableFullScan 10000.00 batchCop[tiflash] table:t keep order:false, stats:pseudo" ] }, { From a4e5599aed5b117da2f3b07a6bae95c0d93f4830 Mon Sep 17 00:00:00 2001 From: qw4990 Date: Fri, 11 Nov 2022 11:13:27 +0800 Subject: [PATCH 07/17] fixup --- planner/core/plan_cost_ver1.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/planner/core/plan_cost_ver1.go b/planner/core/plan_cost_ver1.go index 694639680f4f2..f7459c70fb01a 100644 --- a/planner/core/plan_cost_ver1.go +++ b/planner/core/plan_cost_ver1.go @@ -1273,7 +1273,7 @@ func getCardinality(operator PhysicalPlan, costFlag uint64) float64 { return getOperatorActRows(operator) / float64(actualProbeCnt) } rows := operator.StatsCount() - if rows == 0 { + if rows == 0 && operator.SCtx().GetSessionVars().CostModelVersion == modelVer2 { // 0 est-row can lead to 0 operator cost which makes plan choice unstable. rows = 1 } From 64baf2eb2ea1b322ba432c78f3f2d78ca6eaead5 Mon Sep 17 00:00:00 2001 From: qw4990 Date: Fri, 11 Nov 2022 11:38:53 +0800 Subject: [PATCH 08/17] fixup --- executor/explain_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/executor/explain_test.go b/executor/explain_test.go index 8c1ec9bad03a6..c67c61a67a909 100644 --- a/executor/explain_test.go +++ b/executor/explain_test.go @@ -364,7 +364,7 @@ func TestCheckActRowsWithUnistore(t *testing.T) { }, { sql: "select count(*) from t_unistore_act_rows group by b", - expected: []string{"2", "4", "4"}, + expected: []string{"2", "2", "2", "4"}, }, { sql: "with cte(a) as (select a from t_unistore_act_rows) select (select 1 from cte limit 1) from cte;", From 8835e52522494c77215d8aa325d9076897574e3f Mon Sep 17 00:00:00 2001 From: qw4990 Date: Fri, 11 Nov 2022 11:40:59 +0800 Subject: [PATCH 09/17] fixup --- executor/join_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/executor/join_test.go b/executor/join_test.go index 74b7fd454e4bc..9fd6d2c318818 100644 --- a/executor/join_test.go +++ b/executor/join_test.go @@ -1357,7 +1357,7 @@ func TestIndexLookupJoin(t *testing.T) { tk.MustExec("analyze table s;") tk.MustQuery("desc format = 'brief' select /*+ TIDB_INLJ(s) */ count(*) from t join s use index(idx) on s.a = t.a and s.b < t.b").Check(testkit.Rows( - "StreamAgg 1.00 root funcs:count(1)->Column#6", + "HashAgg 1.00 root funcs:count(1)->Column#6", "└─IndexJoin 64.00 root inner join, inner:IndexReader, outer key:test.t.a, inner key:test.s.a, equal cond:eq(test.t.a, test.s.a), other cond:lt(test.s.b, test.t.b)", " ├─TableReader(Build) 64.00 root data:Selection", " │ └─Selection 64.00 cop[tikv] not(isnull(test.t.b))", @@ -1370,7 +1370,7 @@ func TestIndexLookupJoin(t *testing.T) { tk.MustQuery("select /*+ TIDB_INLJ(s) */ count(*) from t join s use index(idx) on s.a = t.a and s.b < t.b").Check(testkit.Rows("64")) tk.MustQuery("desc format = 'brief' select /*+ INL_MERGE_JOIN(s) */ count(*) from t join s use index(idx) on s.a = t.a and s.b < t.b").Check(testkit.Rows( - "StreamAgg 1.00 root funcs:count(1)->Column#6", + "HashAgg 1.00 root funcs:count(1)->Column#6", "└─IndexMergeJoin 64.00 root inner join, inner:IndexReader, outer key:test.t.a, inner key:test.s.a, other cond:lt(test.s.b, test.t.b)", " ├─TableReader(Build) 64.00 root data:Selection", " │ └─Selection 64.00 cop[tikv] not(isnull(test.t.b))", @@ -1384,7 +1384,7 @@ func TestIndexLookupJoin(t *testing.T) { tk.MustQuery("select /*+ INL_MERGE_JOIN(s) */ count(*) from t join s use index(idx) on s.a = t.a and s.b < t.b").Check(testkit.Rows("64")) tk.MustQuery("desc format = 'brief' select /*+ INL_HASH_JOIN(s) */ count(*) from t join s use index(idx) on s.a = t.a and s.b < t.b").Check(testkit.Rows( - "StreamAgg 1.00 root funcs:count(1)->Column#6", + "HashAgg 1.00 root funcs:count(1)->Column#6", "└─IndexHashJoin 64.00 root inner join, inner:IndexReader, outer key:test.t.a, inner key:test.s.a, equal cond:eq(test.t.a, test.s.a), other cond:lt(test.s.b, test.t.b)", " ├─TableReader(Build) 64.00 root data:Selection", " │ └─Selection 64.00 cop[tikv] not(isnull(test.t.b))", From 517b2fe5161a01ef729ab92ff6ea81adb779ed1c Mon Sep 17 00:00:00 2001 From: qw4990 Date: Fri, 11 Nov 2022 11:42:01 +0800 Subject: [PATCH 10/17] fixup --- planner/core/testdata/plan_suite_out.json | 25 ++++++++++++----------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/planner/core/testdata/plan_suite_out.json b/planner/core/testdata/plan_suite_out.json index a5802be47dc1c..ad66ce13ee3f0 100644 --- a/planner/core/testdata/plan_suite_out.json +++ b/planner/core/testdata/plan_suite_out.json @@ -3467,18 +3467,19 @@ { "SQL": "select count(distinct a) from (select count(distinct deptid) a from employee) x", "Plan": [ - "StreamAgg 1.00 root funcs:count(distinct Column#5)->Column#6", - "└─TableReader 1.00 root data:ExchangeSender", - " └─ExchangeSender 1.00 mpp[tiflash] ExchangeType: PassThrough", - " └─Projection 1.00 mpp[tiflash] Column#5", - " └─HashAgg 1.00 mpp[tiflash] funcs:sum(Column#7)->Column#5", - " └─ExchangeReceiver 1.00 mpp[tiflash] ", - " └─ExchangeSender 1.00 mpp[tiflash] ExchangeType: PassThrough", - " └─HashAgg 1.00 mpp[tiflash] funcs:count(distinct test.employee.deptid)->Column#7", - " └─ExchangeReceiver 1.00 mpp[tiflash] ", - " └─ExchangeSender 1.00 mpp[tiflash] ExchangeType: HashPartition, Hash Cols: [name: test.employee.deptid, collate: binary]", - " └─HashAgg 1.00 mpp[tiflash] group by:test.employee.deptid, ", - " └─TableFullScan 10000.00 mpp[tiflash] table:employee keep order:false, stats:pseudo" + "TableReader 1.00 root data:ExchangeSender", + "└─ExchangeSender 1.00 mpp[tiflash] ExchangeType: PassThrough", + " └─Projection 1.00 mpp[tiflash] Column#6", + " └─HashAgg 1.00 mpp[tiflash] funcs:count(distinct Column#5)->Column#6", + " └─Projection 1.00 mpp[tiflash] Column#5", + " └─HashAgg 1.00 mpp[tiflash] funcs:sum(Column#8)->Column#5", + " └─ExchangeReceiver 1.00 mpp[tiflash] ", + " └─ExchangeSender 1.00 mpp[tiflash] ExchangeType: PassThrough", + " └─HashAgg 1.00 mpp[tiflash] funcs:count(distinct test.employee.deptid)->Column#8", + " └─ExchangeReceiver 1.00 mpp[tiflash] ", + " └─ExchangeSender 1.00 mpp[tiflash] ExchangeType: HashPartition, Hash Cols: [name: test.employee.deptid, collate: binary]", + " └─HashAgg 1.00 mpp[tiflash] group by:test.employee.deptid, ", + " └─TableFullScan 10000.00 mpp[tiflash] table:employee keep order:false, stats:pseudo" ] }, { From cdd04eb8c3b5610b08345013f01575fd98250b2e Mon Sep 17 00:00:00 2001 From: qw4990 Date: Fri, 11 Nov 2022 11:50:31 +0800 Subject: [PATCH 11/17] fixup --- planner/core/testdata/analyze_suite_out.json | 9 +- .../core/testdata/enforce_mpp_suite_out.json | 180 +-- .../expression_rewriter_suite_out.json | 30 +- .../core/testdata/integration_suite_out.json | 1067 +++++++++-------- .../core/testdata/join_reorder_suite_out.json | 86 +- planner/core/testdata/stats_suite_out.json | 24 +- 6 files changed, 729 insertions(+), 667 deletions(-) diff --git a/planner/core/testdata/analyze_suite_out.json b/planner/core/testdata/analyze_suite_out.json index 496cc869b9746..ae93f03ac6c9e 100644 --- a/planner/core/testdata/analyze_suite_out.json +++ b/planner/core/testdata/analyze_suite_out.json @@ -45,9 +45,10 @@ { "SQL": "explain format = 'brief' select count(*) from t group by a", "Plan": [ - "HashAgg 2.00 root group by:test.t.a, funcs:count(1)->Column#3", - "└─TableReader 8.00 root data:TableFullScan", - " └─TableFullScan 8.00 cop[tikv] table:t keep order:false" + "HashAgg 2.00 root group by:test.t.a, funcs:count(Column#4)->Column#3", + "└─TableReader 2.00 root data:HashAgg", + " └─HashAgg 2.00 cop[tikv] group by:test.t.a, funcs:count(1)->Column#4", + " └─TableFullScan 8.00 cop[tikv] table:t keep order:false" ] } ] @@ -382,7 +383,7 @@ "└─Apply 10.00 root CARTESIAN left outer semi join, other cond:eq(test.t.c, Column#21)", " ├─IndexReader(Build) 10.00 root index:IndexFullScan", " │ └─IndexFullScan 10.00 cop[tikv] table:t, index:idx(c, b, a) keep order:false", - " └─StreamAgg(Probe) 10.00 root funcs:count(1)->Column#21", + " └─HashAgg(Probe) 10.00 root funcs:count(1)->Column#21", " └─HashJoin 10.00 root inner join, equal:[eq(test.t.a, test.t.a)]", " ├─IndexReader(Build) 10.00 root index:Selection", " │ └─Selection 10.00 cop[tikv] eq(test.t.a, test.t.a), not(isnull(test.t.a))", diff --git a/planner/core/testdata/enforce_mpp_suite_out.json b/planner/core/testdata/enforce_mpp_suite_out.json index 55bf29f1b4001..e1e3242fb55b5 100644 --- a/planner/core/testdata/enforce_mpp_suite_out.json +++ b/planner/core/testdata/enforce_mpp_suite_out.json @@ -31,30 +31,30 @@ { "SQL": "explain format='verbose' select count(*) from t where a=1", "Plan": [ - "StreamAgg_24 1.00 193.81 root funcs:count(Column#6)->Column#4", - "└─IndexReader_25 1.00 143.91 root index:StreamAgg_9", - " └─StreamAgg_9 1.00 2127.00 cop[tikv] funcs:count(1)->Column#6", - " └─IndexRangeScan_23 10.00 1628.00 cop[tikv] table:t, index:idx(a) range:[1,1], keep order:false, stats:pseudo" + "HashAgg_14 1.00 154.90 root funcs:count(Column#5)->Column#4", + "└─IndexReader_15 1.00 124.64 root index:HashAgg_6", + " └─HashAgg_6 1.00 1837.90 cop[tikv] funcs:count(1)->Column#5", + " └─IndexRangeScan_13 10.00 1628.00 cop[tikv] table:t, index:idx(a) range:[1,1], keep order:false, stats:pseudo" ], "Warn": null }, { "SQL": "explain format='verbose' select /*+ read_from_storage(tikv[t]) */ count(*) from t where a=1", "Plan": [ - "StreamAgg_17 1.00 193.81 root funcs:count(Column#6)->Column#4", - "└─IndexReader_18 1.00 143.91 root index:StreamAgg_9", - " └─StreamAgg_9 1.00 2127.00 cop[tikv] funcs:count(1)->Column#6", - " └─IndexRangeScan_16 10.00 1628.00 cop[tikv] table:t, index:idx(a) range:[1,1], keep order:false, stats:pseudo" + "HashAgg_12 1.00 154.90 root funcs:count(Column#5)->Column#4", + "└─IndexReader_13 1.00 124.64 root index:HashAgg_6", + " └─HashAgg_6 1.00 1837.90 cop[tikv] funcs:count(1)->Column#5", + " └─IndexRangeScan_11 10.00 1628.00 cop[tikv] table:t, index:idx(a) range:[1,1], keep order:false, stats:pseudo" ], "Warn": null }, { "SQL": "explain format='verbose' select /*+ read_from_storage(tiflash[t]) */ count(*) from t where a=1", "Plan": [ - "StreamAgg_10 1.00 64007.91 root funcs:count(1)->Column#4", - "└─TableReader_24 10.00 63508.91 root data:Selection_23", - " └─Selection_23 10.00 952000.00 cop[tiflash] eq(test.t.a, 1)", - " └─TableFullScan_22 10000.00 928000.00 cop[tiflash] table:t keep order:false, stats:pseudo" + "HashAgg_8 1.00 63718.81 root funcs:count(1)->Column#4", + "└─TableReader_17 10.00 63508.91 root data:Selection_16", + " └─Selection_16 10.00 952000.00 cop[tiflash] eq(test.t.a, 1)", + " └─TableFullScan_15 10000.00 928000.00 cop[tiflash] table:t keep order:false, stats:pseudo" ], "Warn": null }, @@ -71,30 +71,32 @@ { "SQL": "explain format='verbose' select count(*) from t where a=1", "Plan": [ - "StreamAgg_31 1.00 193.81 root funcs:count(Column#7)->Column#4", - "└─IndexReader_32 1.00 143.91 root index:StreamAgg_11", - " └─StreamAgg_11 1.00 2127.00 cop[tikv] funcs:count(1)->Column#7", - " └─IndexRangeScan_30 10.00 1628.00 cop[tikv] table:t, index:idx(a) range:[1,1], keep order:false, stats:pseudo" + "HashAgg_16 1.00 154.90 root funcs:count(Column#5)->Column#4", + "└─IndexReader_17 1.00 124.64 root index:HashAgg_7", + " └─HashAgg_7 1.00 1837.90 cop[tikv] funcs:count(1)->Column#5", + " └─IndexRangeScan_15 10.00 1628.00 cop[tikv] table:t, index:idx(a) range:[1,1], keep order:false, stats:pseudo" ], "Warn": null }, { "SQL": "explain format='verbose' select /*+ read_from_storage(tikv[t]) */ count(*) from t where a=1", "Plan": [ - "StreamAgg_19 1.00 193.81 root funcs:count(Column#6)->Column#4", - "└─IndexReader_20 1.00 143.91 root index:StreamAgg_11", - " └─StreamAgg_11 1.00 2127.00 cop[tikv] funcs:count(1)->Column#6", - " └─IndexRangeScan_18 10.00 1628.00 cop[tikv] table:t, index:idx(a) range:[1,1], keep order:false, stats:pseudo" + "HashAgg_14 1.00 154.90 root funcs:count(Column#5)->Column#4", + "└─IndexReader_15 1.00 124.64 root index:HashAgg_7", + " └─HashAgg_7 1.00 1837.90 cop[tikv] funcs:count(1)->Column#5", + " └─IndexRangeScan_13 10.00 1628.00 cop[tikv] table:t, index:idx(a) range:[1,1], keep order:false, stats:pseudo" ], "Warn": null }, { "SQL": "explain format='verbose' select /*+ read_from_storage(tiflash[t]) */ count(*) from t where a=1", "Plan": [ - "StreamAgg_12 1.00 64007.91 root funcs:count(1)->Column#4", - "└─TableReader_31 10.00 63508.91 root data:Selection_30", - " └─Selection_30 10.00 952000.00 cop[tiflash] eq(test.t.a, 1)", - " └─TableFullScan_29 10000.00 928000.00 cop[tiflash] table:t keep order:false, stats:pseudo" + "HashAgg_22 1.00 63498.78 root funcs:count(Column#6)->Column#4", + "└─TableReader_24 1.00 63468.52 root data:ExchangeSender_23", + " └─ExchangeSender_23 1.00 952010.16 mpp[tiflash] ExchangeType: PassThrough", + " └─HashAgg_10 1.00 952010.16 mpp[tiflash] funcs:count(1)->Column#6", + " └─Selection_21 10.00 952000.00 mpp[tiflash] eq(test.t.a, 1)", + " └─TableFullScan_20 10000.00 928000.00 mpp[tiflash] table:t keep order:false, stats:pseudo" ], "Warn": null }, @@ -106,30 +108,32 @@ { "SQL": "explain format='verbose' select count(*) from t where a=1", "Plan": [ - "StreamAgg_31 1.00 193.81 root funcs:count(Column#7)->Column#4", - "└─IndexReader_32 1.00 143.91 root index:StreamAgg_11", - " └─StreamAgg_11 1.00 2127.00 cop[tikv] funcs:count(1)->Column#7", - " └─IndexRangeScan_30 10.00 1628.00 cop[tikv] table:t, index:idx(a) range:[1,1], keep order:false, stats:pseudo" + "HashAgg_16 1.00 154.90 root funcs:count(Column#5)->Column#4", + "└─IndexReader_17 1.00 124.64 root index:HashAgg_7", + " └─HashAgg_7 1.00 1837.90 cop[tikv] funcs:count(1)->Column#5", + " └─IndexRangeScan_15 10.00 1628.00 cop[tikv] table:t, index:idx(a) range:[1,1], keep order:false, stats:pseudo" ], "Warn": null }, { "SQL": "explain format='verbose' select /*+ read_from_storage(tikv[t]) */ count(*) from t where a=1", "Plan": [ - "StreamAgg_19 1.00 193.81 root funcs:count(Column#6)->Column#4", - "└─IndexReader_20 1.00 143.91 root index:StreamAgg_11", - " └─StreamAgg_11 1.00 2127.00 cop[tikv] funcs:count(1)->Column#6", - " └─IndexRangeScan_18 10.00 1628.00 cop[tikv] table:t, index:idx(a) range:[1,1], keep order:false, stats:pseudo" + "HashAgg_14 1.00 154.90 root funcs:count(Column#5)->Column#4", + "└─IndexReader_15 1.00 124.64 root index:HashAgg_7", + " └─HashAgg_7 1.00 1837.90 cop[tikv] funcs:count(1)->Column#5", + " └─IndexRangeScan_13 10.00 1628.00 cop[tikv] table:t, index:idx(a) range:[1,1], keep order:false, stats:pseudo" ], "Warn": null }, { "SQL": "explain format='verbose' select /*+ read_from_storage(tiflash[t]) */ count(*) from t where a=1", "Plan": [ - "StreamAgg_12 1.00 64007.91 root funcs:count(1)->Column#4", - "└─TableReader_31 10.00 63508.91 root data:Selection_30", - " └─Selection_30 10.00 952000.00 cop[tiflash] eq(test.t.a, 1)", - " └─TableFullScan_29 10000.00 928000.00 cop[tiflash] table:t keep order:false, stats:pseudo" + "HashAgg_22 1.00 63498.78 root funcs:count(Column#6)->Column#4", + "└─TableReader_24 1.00 63468.52 root data:ExchangeSender_23", + " └─ExchangeSender_23 1.00 952010.16 mpp[tiflash] ExchangeType: PassThrough", + " └─HashAgg_10 1.00 952010.16 mpp[tiflash] funcs:count(1)->Column#6", + " └─Selection_21 10.00 952000.00 mpp[tiflash] eq(test.t.a, 1)", + " └─TableFullScan_20 10000.00 928000.00 mpp[tiflash] table:t keep order:false, stats:pseudo" ], "Warn": null }, @@ -141,20 +145,22 @@ { "SQL": "explain format='verbose' select count(*) from t where a=1", "Plan": [ - "StreamAgg_31 1.00 193.81 root funcs:count(Column#7)->Column#4", - "└─IndexReader_32 1.00 143.91 root index:StreamAgg_11", - " └─StreamAgg_11 1.00 2127.00 cop[tikv] funcs:count(1)->Column#7", - " └─IndexRangeScan_30 10.00 1628.00 cop[tikv] table:t, index:idx(a) range:[1,1], keep order:false, stats:pseudo" + "HashAgg_25 1.00 30.26 root funcs:count(Column#6)->Column#4", + "└─TableReader_27 1.00 0.00 root data:ExchangeSender_26", + " └─ExchangeSender_26 1.00 952010.16 mpp[tiflash] ExchangeType: PassThrough", + " └─HashAgg_10 1.00 952010.16 mpp[tiflash] funcs:count(1)->Column#6", + " └─Selection_24 10.00 952000.00 mpp[tiflash] eq(test.t.a, 1)", + " └─TableFullScan_23 10000.00 928000.00 mpp[tiflash] table:t keep order:false, stats:pseudo" ], "Warn": null }, { "SQL": "explain format='verbose' select /*+ read_from_storage(tikv[t]) */ count(*) from t where a=1", "Plan": [ - "StreamAgg_19 1.00 193.81 root funcs:count(Column#6)->Column#4", - "└─IndexReader_20 1.00 143.91 root index:StreamAgg_11", - " └─StreamAgg_11 1.00 2127.00 cop[tikv] funcs:count(1)->Column#6", - " └─IndexRangeScan_18 10.00 1628.00 cop[tikv] table:t, index:idx(a) range:[1,1], keep order:false, stats:pseudo" + "HashAgg_14 1.00 154.90 root funcs:count(Column#5)->Column#4", + "└─IndexReader_15 1.00 124.64 root index:HashAgg_7", + " └─HashAgg_7 1.00 1837.90 cop[tikv] funcs:count(1)->Column#5", + " └─IndexRangeScan_13 10.00 1628.00 cop[tikv] table:t, index:idx(a) range:[1,1], keep order:false, stats:pseudo" ], "Warn": [ "MPP mode may be blocked because you have set a hint to read table `t` from TiKV." @@ -163,10 +169,10 @@ { "SQL": "explain format='verbose' select /*+ read_from_storage(tiflash[t]) */ count(*) from t where a=1", "Plan": [ - "HashAgg_22 1.00 39930.30 root funcs:count(Column#6)->Column#4", + "HashAgg_22 1.00 30.26 root funcs:count(Column#6)->Column#4", "└─TableReader_24 1.00 0.00 root data:ExchangeSender_23", - " └─ExchangeSender_23 1.00 953920.56 mpp[tiflash] ExchangeType: PassThrough", - " └─HashAgg_10 1.00 953920.56 mpp[tiflash] funcs:count(1)->Column#6", + " └─ExchangeSender_23 1.00 952010.16 mpp[tiflash] ExchangeType: PassThrough", + " └─HashAgg_10 1.00 952010.16 mpp[tiflash] funcs:count(1)->Column#6", " └─Selection_21 10.00 952000.00 mpp[tiflash] eq(test.t.a, 1)", " └─TableFullScan_20 10000.00 928000.00 mpp[tiflash] table:t keep order:false, stats:pseudo" ], @@ -185,9 +191,9 @@ { "SQL": "explain format = 'brief' select count(*) from t where a=1 -- 1. no replica", "Plan": [ - "StreamAgg 1.00 root funcs:count(Column#8)->Column#6", - "└─IndexReader 1.00 root index:StreamAgg", - " └─StreamAgg 1.00 cop[tikv] funcs:count(1)->Column#8", + "HashAgg 1.00 root funcs:count(Column#7)->Column#6", + "└─IndexReader 1.00 root index:HashAgg", + " └─HashAgg 1.00 cop[tikv] funcs:count(1)->Column#7", " └─IndexRangeScan 10.00 cop[tikv] table:t, index:idx(a) range:[1,1], keep order:false, stats:pseudo" ], "Warn": [ @@ -202,10 +208,10 @@ { "SQL": "explain select count(*) from t where a=1 -- 2. replica not ready", "Plan": [ - "StreamAgg_17 1.00 root funcs:count(Column#8)->Column#6", - "└─IndexReader_18 1.00 root index:StreamAgg_9", - " └─StreamAgg_9 1.00 cop[tikv] funcs:count(1)->Column#8", - " └─IndexRangeScan_16 10.00 cop[tikv] table:t, index:idx(a) range:[1,1], keep order:false, stats:pseudo" + "HashAgg_12 1.00 root funcs:count(Column#7)->Column#6", + "└─IndexReader_13 1.00 root index:HashAgg_6", + " └─HashAgg_6 1.00 cop[tikv] funcs:count(1)->Column#7", + " └─IndexRangeScan_11 10.00 cop[tikv] table:t, index:idx(a) range:[1,1], keep order:false, stats:pseudo" ], "Warn": [ "MPP mode may be blocked because tiflash replicas of table `t` not ready." @@ -224,10 +230,10 @@ { "SQL": "explain select count(*) from t where a=1 -- 3. isolation_engine not match", "Plan": [ - "StreamAgg_17 1.00 root funcs:count(Column#8)->Column#6", - "└─IndexReader_18 1.00 root index:StreamAgg_9", - " └─StreamAgg_9 1.00 cop[tikv] funcs:count(1)->Column#8", - " └─IndexRangeScan_16 10.00 cop[tikv] table:t, index:idx(a) range:[1,1], keep order:false, stats:pseudo" + "HashAgg_12 1.00 root funcs:count(Column#7)->Column#6", + "└─IndexReader_13 1.00 root index:HashAgg_6", + " └─HashAgg_6 1.00 cop[tikv] funcs:count(1)->Column#7", + " └─IndexRangeScan_11 10.00 cop[tikv] table:t, index:idx(a) range:[1,1], keep order:false, stats:pseudo" ], "Warn": [ "MPP mode may be blocked because 'tidb_isolation_read_engines'(value: 'tikv') not match, need 'tiflash'." @@ -241,9 +247,9 @@ { "SQL": "explain format = 'brief' select /*+ read_from_storage(tikv[t]) */ count(*) from t where a=1 -- 4. hint use tikv", "Plan": [ - "StreamAgg 1.00 root funcs:count(Column#8)->Column#6", - "└─IndexReader 1.00 root index:StreamAgg", - " └─StreamAgg 1.00 cop[tikv] funcs:count(1)->Column#8", + "HashAgg 1.00 root funcs:count(Column#7)->Column#6", + "└─IndexReader 1.00 root index:HashAgg", + " └─HashAgg 1.00 cop[tikv] funcs:count(1)->Column#7", " └─IndexRangeScan 10.00 cop[tikv] table:t, index:idx(a) range:[1,1], keep order:false, stats:pseudo" ], "Warn": [ @@ -281,16 +287,16 @@ { "SQL": "EXPLAIN format = 'brief' SELECT count(b) from t where a=1; -- 7. agg func has virtual column", "Plan": [ - "StreamAgg 1.00 root funcs:count(test.t.b)->Column#6", - "└─IndexLookUp 10.00 root ", - " ├─IndexRangeScan(Build) 10.00 cop[tikv] table:t, index:idx(a) range:[1,1], keep order:false, stats:pseudo", - " └─TableRowIDScan(Probe) 10.00 cop[tikv] table:t keep order:false, stats:pseudo" + "HashAgg 1.00 root funcs:count(test.t.b)->Column#6", + "└─TableReader 10.00 root data:Selection", + " └─Selection 10.00 cop[tiflash] eq(test.t.a, 1)", + " └─TableFullScan 10000.00 cop[tiflash] table:t keep order:false, stats:pseudo" ], "Warn": [ + "Aggregation can not be pushed to tiflash because expressions of AggFunc `count` contain virtual column or correlated column, which is not supported now", "Aggregation can not be pushed to tiflash because expressions of AggFunc `count` contain virtual column or correlated column, which is not supported now", "Aggregation can not be pushed to tikv because expressions of AggFunc `count` contain virtual column or correlated column, which is not supported now", - "Aggregation can not be pushed to tikv because expressions of AggFunc `count` contain virtual column or correlated column, which is not supported now", - "Aggregation can not be pushed to tikv because expressions of AggFunc `count` contain virtual column or correlated column, which is not supported now", + "Aggregation can not be pushed to tiflash because expressions of AggFunc `count` contain virtual column or correlated column, which is not supported now", "Aggregation can not be pushed to tiflash because expressions of AggFunc `count` contain virtual column or correlated column, which is not supported now" ] }, @@ -304,19 +310,21 @@ ], "Warn": [ "Aggregation can not be pushed to tiflash because groupByItems contain virtual columns, which is not supported now", - "Aggregation can not be pushed to tikv because groupByItems contain virtual columns, which is not supported now", + "Aggregation can not be pushed to tiflash because groupByItems contain virtual columns, which is not supported now", "Aggregation can not be pushed to tiflash because groupByItems contain virtual columns, which is not supported now" ] }, { "SQL": "EXPLAIN format = 'brief' SELECT count(a) from t group by md5(a); -- 10. scalar func not supported", "Plan": [ - "HashAgg 8000.00 root group by:Column#7, funcs:count(Column#8)->Column#6", - "└─IndexReader 8000.00 root index:HashAgg", - " └─HashAgg 8000.00 cop[tikv] group by:md5(cast(test.t.a, var_string(20))), funcs:count(test.t.a)->Column#8", - " └─IndexFullScan 10000.00 cop[tikv] table:t, index:idx(a) keep order:false, stats:pseudo" + "HashAgg 8000.00 root group by:Column#8, funcs:count(Column#7)->Column#6", + "└─Projection 10000.00 root test.t.a, md5(cast(test.t.a, var_string(20)))->Column#8", + " └─TableReader 10000.00 root data:TableFullScan", + " └─TableFullScan 10000.00 cop[tiflash] table:t keep order:false, stats:pseudo" ], "Warn": [ + "Scalar function 'md5'(signature: MD5, return type: var_string(32)) is not supported to push down to tiflash now.", + "Aggregation can not be pushed to tiflash because groupByItems contain unsupported exprs", "Scalar function 'md5'(signature: MD5, return type: var_string(32)) is not supported to push down to tiflash now.", "Aggregation can not be pushed to tiflash because groupByItems contain unsupported exprs", "Scalar function 'md5'(signature: MD5, return type: var_string(32)) is not supported to push down to tiflash now.", @@ -326,11 +334,10 @@ { "SQL": "EXPLAIN format = 'brief' SELECT count(a) from t where c=1; -- 11. type not supported", "Plan": [ - "StreamAgg 1.00 root funcs:count(Column#8)->Column#6", - "└─TableReader 1.00 root data:StreamAgg", - " └─StreamAgg 1.00 cop[tikv] funcs:count(test.t.a)->Column#8", - " └─Selection 10.00 cop[tikv] eq(test.t.c, 1)", - " └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo" + "HashAgg 1.00 root funcs:count(test.t.a)->Column#6", + "└─TableReader 10.00 root data:Selection", + " └─Selection 10.00 cop[tikv] eq(test.t.c, 1)", + " └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo" ], "Warn": [ "Expression about 'test.t.c' can not be pushed to TiFlash because it contains unsupported calculation of type 'enum'.", @@ -343,11 +350,10 @@ { "SQL": "EXPLAIN format = 'brief' SELECT count(a) from t where d=1; -- 11.1. type not supported", "Plan": [ - "StreamAgg 1.00 root funcs:count(Column#8)->Column#6", - "└─TableReader 1.00 root data:StreamAgg", - " └─StreamAgg 1.00 cop[tikv] funcs:count(test.t.a)->Column#8", - " └─Selection 10.00 cop[tikv] eq(test.t.d, 1)", - " └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo" + "HashAgg 1.00 root funcs:count(test.t.a)->Column#6", + "└─TableReader 10.00 root data:Selection", + " └─Selection 10.00 cop[tikv] eq(test.t.d, 1)", + " └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo" ], "Warn": [ "Expression about 'test.t.d' can not be pushed to TiFlash because it contains unsupported calculation of type 'bit'.", @@ -375,11 +381,11 @@ { "SQL": "EXPLAIN SELECT count(*) from t where a=1; -- 1. static partition prune", "Plan": [ - "StreamAgg_32 1.00 root funcs:count(Column#6)->Column#4", - "└─TableReader_33 1.00 root data:StreamAgg_13", - " └─StreamAgg_13 1.00 batchCop[tiflash] funcs:count(1)->Column#6", - " └─Selection_31 10.00 batchCop[tiflash] eq(test.t.a, 1)", - " └─TableFullScan_30 10000.00 batchCop[tiflash] table:t, partition:p0 keep order:false, stats:pseudo" + "HashAgg_19 1.00 root funcs:count(Column#5)->Column#4", + "└─TableReader_20 1.00 root data:HashAgg_9", + " └─HashAgg_9 1.00 batchCop[tiflash] funcs:count(1)->Column#5", + " └─Selection_18 10.00 batchCop[tiflash] eq(test.t.a, 1)", + " └─TableFullScan_17 10000.00 batchCop[tiflash] table:t, partition:p0 keep order:false, stats:pseudo" ], "Warn": [ "MPP mode may be blocked because table `t`is a partition table which is not supported when `@@tidb_partition_prune_mode=static`." diff --git a/planner/core/testdata/expression_rewriter_suite_out.json b/planner/core/testdata/expression_rewriter_suite_out.json index 72b86884a1412..0a492a09236b0 100644 --- a/planner/core/testdata/expression_rewriter_suite_out.json +++ b/planner/core/testdata/expression_rewriter_suite_out.json @@ -7,9 +7,10 @@ "Plan": [ "HashJoin 2.25 root inner join, equal:[eq(test.t1.a, test.t2.a) eq(test.t1.b, test.t2.b)]", "├─HashAgg(Build) 1.69 root group by:test.t2.a, test.t2.b, funcs:firstrow(test.t2.a)->test.t2.a, funcs:firstrow(test.t2.b)->test.t2.b", - "│ └─TableReader 2.25 root data:Selection", - "│ └─Selection 2.25 cop[tikv] not(isnull(test.t2.a)), not(isnull(test.t2.b))", - "│ └─TableFullScan 4.00 cop[tikv] table:t2 keep order:false", + "│ └─TableReader 1.69 root data:HashAgg", + "│ └─HashAgg 1.69 cop[tikv] group by:test.t2.a, test.t2.b, ", + "│ └─Selection 2.25 cop[tikv] not(isnull(test.t2.a)), not(isnull(test.t2.b))", + "│ └─TableFullScan 4.00 cop[tikv] table:t2 keep order:false", "└─TableReader(Probe) 2.25 root data:Selection", " └─Selection 2.25 cop[tikv] not(isnull(test.t1.a)), not(isnull(test.t1.b))", " └─TableFullScan 4.00 cop[tikv] table:t1 keep order:false" @@ -36,13 +37,15 @@ "Plan": [ "HashJoin 1.69 root inner join, equal:[eq(test.t2.a, test.t1.a) eq(test.t2.b, Column#7)]", "├─HashAgg(Build) 1.69 root group by:test.t2.a, test.t2.b, funcs:firstrow(test.t2.a)->test.t2.a, funcs:firstrow(test.t2.b)->test.t2.b", - "│ └─TableReader 2.25 root data:Selection", - "│ └─Selection 2.25 cop[tikv] not(isnull(test.t2.a)), not(isnull(test.t2.b))", - "│ └─TableFullScan 4.00 cop[tikv] table:t2 keep order:false", - "└─HashAgg(Probe) 2.25 root group by:test.t1.a, funcs:count(1)->Column#7, funcs:firstrow(test.t1.a)->test.t1.a", - " └─TableReader 3.00 root data:Selection", - " └─Selection 3.00 cop[tikv] not(isnull(test.t1.a))", - " └─TableFullScan 4.00 cop[tikv] table:t1 keep order:false" + "│ └─TableReader 1.69 root data:HashAgg", + "│ └─HashAgg 1.69 cop[tikv] group by:test.t2.a, test.t2.b, ", + "│ └─Selection 2.25 cop[tikv] not(isnull(test.t2.a)), not(isnull(test.t2.b))", + "│ └─TableFullScan 4.00 cop[tikv] table:t2 keep order:false", + "└─HashAgg(Probe) 2.25 root group by:test.t1.a, funcs:count(Column#14)->Column#7, funcs:firstrow(test.t1.a)->test.t1.a", + " └─TableReader 2.25 root data:HashAgg", + " └─HashAgg 2.25 cop[tikv] group by:test.t1.a, funcs:count(1)->Column#14", + " └─Selection 3.00 cop[tikv] not(isnull(test.t1.a))", + " └─TableFullScan 4.00 cop[tikv] table:t1 keep order:false" ], "Res": [ "1" @@ -54,9 +57,10 @@ "HashJoin 2.40 root CARTESIAN anti semi join, other cond:eq(Column#7, test.t2.b), eq(test.t1.a, test.t2.a)", "├─TableReader(Build) 4.00 root data:TableFullScan", "│ └─TableFullScan 4.00 cop[tikv] table:t2 keep order:false", - "└─HashAgg(Probe) 3.00 root group by:test.t1.a, funcs:count(1)->Column#7, funcs:firstrow(test.t1.a)->test.t1.a", - " └─TableReader 4.00 root data:TableFullScan", - " └─TableFullScan 4.00 cop[tikv] table:t1 keep order:false" + "└─HashAgg(Probe) 3.00 root group by:test.t1.a, funcs:count(Column#12)->Column#7, funcs:firstrow(test.t1.a)->test.t1.a", + " └─TableReader 3.00 root data:HashAgg", + " └─HashAgg 3.00 cop[tikv] group by:test.t1.a, funcs:count(1)->Column#12", + " └─TableFullScan 4.00 cop[tikv] table:t1 keep order:false" ], "Res": [ "4" diff --git a/planner/core/testdata/integration_suite_out.json b/planner/core/testdata/integration_suite_out.json index 08cccff12814e..28b80a4ed218e 100644 --- a/planner/core/testdata/integration_suite_out.json +++ b/planner/core/testdata/integration_suite_out.json @@ -175,12 +175,12 @@ "Plan": [ "HashAgg 2.00 root group by:Column#5, funcs:firstrow(Column#5)->Column#5", "└─Union 2.00 root ", - " ├─StreamAgg 1.00 root funcs:max(test.t.a)->Column#2", + " ├─HashAgg 1.00 root funcs:max(test.t.a)->Column#2", " │ └─Limit 1.00 root offset:0, count:1", " │ └─TableReader 1.00 root data:Limit", " │ └─Limit 1.00 cop[tikv] offset:0, count:1", " │ └─TableFullScan 1.00 cop[tikv] table:t keep order:true, desc, stats:pseudo", - " └─StreamAgg 1.00 root funcs:min(test.t.a)->Column#4", + " └─HashAgg 1.00 root funcs:min(test.t.a)->Column#4", " └─Limit 1.00 root offset:0, count:1", " └─TableReader 1.00 root data:Limit", " └─Limit 1.00 cop[tikv] offset:0, count:1", @@ -191,12 +191,12 @@ "SQL": "explain format = 'brief' select min(a), max(a) from cluster_index_t", "Plan": [ "HashJoin 1.00 root CARTESIAN inner join", - "├─StreamAgg(Build) 1.00 root funcs:max(test.cluster_index_t.a)->Column#5", + "├─HashAgg(Build) 1.00 root funcs:max(test.cluster_index_t.a)->Column#5", "│ └─Limit 1.00 root offset:0, count:1", "│ └─TableReader 1.00 root data:Limit", "│ └─Limit 1.00 cop[tikv] offset:0, count:1", "│ └─TableFullScan 1.00 cop[tikv] table:cluster_index_t keep order:true, desc, stats:pseudo", - "└─StreamAgg(Probe) 1.00 root funcs:min(test.cluster_index_t.a)->Column#4", + "└─HashAgg(Probe) 1.00 root funcs:min(test.cluster_index_t.a)->Column#4", " └─Limit 1.00 root offset:0, count:1", " └─TableReader 1.00 root data:Limit", " └─Limit 1.00 cop[tikv] offset:0, count:1", @@ -207,12 +207,12 @@ "SQL": "explain format = 'brief' select min(b), max(b) from cluster_index_t where a = 1", "Plan": [ "HashJoin 1.00 root CARTESIAN inner join", - "├─StreamAgg(Build) 1.00 root funcs:max(test.cluster_index_t.b)->Column#5", + "├─HashAgg(Build) 1.00 root funcs:max(test.cluster_index_t.b)->Column#5", "│ └─Limit 1.00 root offset:0, count:1", "│ └─TableReader 1.00 root data:Limit", "│ └─Limit 1.00 cop[tikv] offset:0, count:1", "│ └─TableRangeScan 1.00 cop[tikv] table:cluster_index_t range:[1,1], keep order:true, desc, stats:pseudo", - "└─StreamAgg(Probe) 1.00 root funcs:min(test.cluster_index_t.b)->Column#4", + "└─HashAgg(Probe) 1.00 root funcs:min(test.cluster_index_t.b)->Column#4", " └─Limit 1.00 root offset:0, count:1", " └─TableReader 1.00 root data:Limit", " └─Limit 1.00 cop[tikv] offset:0, count:1", @@ -222,9 +222,9 @@ { "SQL": "explain format = 'brief' select min(a), max(a) from cluster_index_t where b = 1", "Plan": [ - "StreamAgg 1.00 root funcs:min(Column#8)->Column#4, funcs:max(Column#9)->Column#5", - "└─TableReader 1.00 root data:StreamAgg", - " └─StreamAgg 1.00 cop[tikv] funcs:min(test.cluster_index_t.a)->Column#8, funcs:max(test.cluster_index_t.a)->Column#9", + "HashAgg 1.00 root funcs:min(Column#6)->Column#4, funcs:max(Column#7)->Column#5", + "└─TableReader 1.00 root data:HashAgg", + " └─HashAgg 1.00 cop[tikv] funcs:min(test.cluster_index_t.a)->Column#6, funcs:max(test.cluster_index_t.a)->Column#7", " └─Selection 10.00 cop[tikv] eq(test.cluster_index_t.b, 1)", " └─TableFullScan 10000.00 cop[tikv] table:cluster_index_t keep order:false, stats:pseudo" ] @@ -232,9 +232,9 @@ { "SQL": "explain format = 'brief' select min(b), max(b) from cluster_index_t where b = 1", "Plan": [ - "StreamAgg 1.00 root funcs:min(Column#8)->Column#4, funcs:max(Column#9)->Column#5", - "└─TableReader 1.00 root data:StreamAgg", - " └─StreamAgg 1.00 cop[tikv] funcs:min(test.cluster_index_t.b)->Column#8, funcs:max(test.cluster_index_t.b)->Column#9", + "HashAgg 1.00 root funcs:min(Column#6)->Column#4, funcs:max(Column#7)->Column#5", + "└─TableReader 1.00 root data:HashAgg", + " └─HashAgg 1.00 cop[tikv] funcs:min(test.cluster_index_t.b)->Column#6, funcs:max(test.cluster_index_t.b)->Column#7", " └─Selection 10.00 cop[tikv] eq(test.cluster_index_t.b, 1)", " └─TableFullScan 10000.00 cop[tikv] table:cluster_index_t keep order:false, stats:pseudo" ] @@ -2051,8 +2051,8 @@ { "SQL": "explain format = 'verbose' select * from t where b = 6 order by a limit 1", "Plan": [ - "Limit_11 0.00 92.40 root offset:0, count:1", - "└─TableReader_24 0.00 92.40 root data:Limit_23", + "Limit_11 0.00 98.74 root offset:0, count:1", + "└─TableReader_24 0.00 98.74 root data:Limit_23", " └─Limit_23 0.00 1386.04 cop[tikv] offset:0, count:1", " └─Selection_22 0.00 1386.04 cop[tikv] eq(test.t.b, 6)", " └─TableFullScan_21 5.00 1136.54 cop[tikv] table:t keep order:true" @@ -2062,8 +2062,8 @@ { "SQL": "explain format = 'verbose' select * from t where b = 6 limit 1", "Plan": [ - "Limit_8 0.00 92.40 root offset:0, count:1", - "└─TableReader_13 0.00 92.40 root data:Limit_12", + "Limit_8 0.00 98.74 root offset:0, count:1", + "└─TableReader_13 0.00 98.74 root data:Limit_12", " └─Limit_12 0.00 1386.04 cop[tikv] offset:0, count:1", " └─Selection_11 0.00 1386.04 cop[tikv] eq(test.t.b, 6)", " └─TableFullScan_10 5.00 1136.54 cop[tikv] table:t keep order:false" @@ -2089,11 +2089,11 @@ { "SQL": "explain format = 'verbose' select * from t where b = 6 order by a limit 1", "Plan": [ - "TopN_9 0.00 1925.01 root test.t.a, offset:0, count:1", - "└─IndexLookUp_16 0.00 1920.21 root ", - " ├─TopN_15(Build) 0.00 3.20 cop[tikv] test.t.a, offset:0, count:1", - " │ └─IndexRangeScan_13 0.00 0.00 cop[tikv] table:t, index:idx_b(b) range:[6,6], keep order:false", - " └─TableRowIDScan_14(Probe) 0.00 0.00 cop[tikv] table:t keep order:false" + "TopN_9 0.00 1956.63 root test.t.a, offset:0, count:1", + "└─IndexLookUp_16 0.00 1951.83 root ", + " ├─TopN_15(Build) 0.00 206.70 cop[tikv] test.t.a, offset:0, count:1", + " │ └─IndexRangeScan_13 0.00 203.50 cop[tikv] table:t, index:idx_b(b) range:[6,6], keep order:false", + " └─TableRowIDScan_14(Probe) 0.00 186.61 cop[tikv] table:t keep order:false" ], "Warnings": [ "Note 1105 [idx_b] remain after pruning paths for t given Prop{SortItems: [], TaskTp: copDoubleReadTask}" @@ -2102,10 +2102,10 @@ { "SQL": "explain format = 'verbose' select * from t where b = 6 limit 1", "Plan": [ - "IndexLookUp_13 0.00 1152.00 root limit embedded(offset:0, count:1)", - "├─Limit_12(Build) 0.00 0.00 cop[tikv] offset:0, count:1", - "│ └─IndexRangeScan_10 0.00 0.00 cop[tikv] table:t, index:idx_b(b) range:[6,6], keep order:false", - "└─TableRowIDScan_11(Probe) 0.00 0.00 cop[tikv] table:t keep order:false" + "IndexLookUp_13 0.00 1170.97 root limit embedded(offset:0, count:1)", + "├─Limit_12(Build) 0.00 203.50 cop[tikv] offset:0, count:1", + "│ └─IndexRangeScan_10 0.00 203.50 cop[tikv] table:t, index:idx_b(b) range:[6,6], keep order:false", + "└─TableRowIDScan_11(Probe) 0.00 186.61 cop[tikv] table:t keep order:false" ], "Warnings": [ "Note 1105 [idx_b] remain after pruning paths for t given Prop{SortItems: [], TaskTp: copDoubleReadTask}" @@ -2413,9 +2413,9 @@ { "SQL": "explain format = 'brief' select count(*) from t31240;", "Plan": [ - "StreamAgg 1.00 root funcs:count(Column#6)->Column#4", - "└─TableReader 1.00 root data:StreamAgg", - " └─StreamAgg 1.00 batchCop[tiflash] funcs:count(1)->Column#6", + "HashAgg 1.00 root funcs:count(Column#5)->Column#4", + "└─TableReader 1.00 root data:HashAgg", + " └─HashAgg 1.00 batchCop[tiflash] funcs:count(1)->Column#5", " └─TableFullScan 10000.00 batchCop[tiflash] table:t31240 keep order:false, stats:pseudo" ] }, @@ -2426,9 +2426,9 @@ { "SQL": "explain format = 'brief' select count(*) from t31240;", "Plan": [ - "StreamAgg 1.00 root funcs:count(Column#6)->Column#4", - "└─TableReader 1.00 root data:StreamAgg", - " └─StreamAgg 1.00 batchCop[tiflash] funcs:count(1)->Column#6", + "HashAgg 1.00 root funcs:count(Column#5)->Column#4", + "└─TableReader 1.00 root data:HashAgg", + " └─HashAgg 1.00 batchCop[tiflash] funcs:count(1)->Column#5", " └─TableFullScan 10000.00 batchCop[tiflash] table:t31240 keep order:false, stats:pseudo" ] } @@ -2485,19 +2485,19 @@ { "SQL": "explain format = 'verbose' select count(*) from t3", "Plan": [ - "StreamAgg_20 1.00 102.69 root funcs:count(Column#9)->Column#4", - "└─IndexReader_21 1.00 52.79 root index:StreamAgg_8", - " └─StreamAgg_8 1.00 760.20 cop[tikv] funcs:count(1)->Column#9", - " └─IndexFullScan_19 3.00 610.50 cop[tikv] table:t3, index:c(b) keep order:false" + "HashAgg_12 1.00 77.75 root funcs:count(Column#6)->Column#4", + "└─IndexReader_13 1.00 47.49 root index:HashAgg_5", + " └─HashAgg_5 1.00 680.68 cop[tikv] funcs:count(1)->Column#6", + " └─IndexFullScan_11 3.00 610.50 cop[tikv] table:t3, index:c(b) keep order:false" ] }, { "SQL": "explain format = 'verbose' select count(*) from t2", "Plan": [ - "StreamAgg_26 1.00 107.45 root funcs:count(Column#7)->Column#4", - "└─TableReader_27 1.00 57.55 root data:StreamAgg_10", - " └─StreamAgg_10 1.00 831.62 cop[tikv] funcs:count(1)->Column#7", - " └─TableFullScan_24 3.00 681.92 cop[tikv] table:t2 keep order:false" + "HashAgg_14 1.00 82.51 root funcs:count(Column#5)->Column#4", + "└─TableReader_15 1.00 52.25 root data:HashAgg_6", + " └─HashAgg_6 1.00 752.10 cop[tikv] funcs:count(1)->Column#5", + " └─TableFullScan_12 3.00 681.92 cop[tikv] table:t2 keep order:false" ] }, { @@ -2537,46 +2537,45 @@ { "SQL": "explain format = 'verbose' select count(*) from t2 group by a", "Plan": [ - "TableReader_44 3.00 31142.18 root data:ExchangeSender_43", - "└─ExchangeSender_43 3.00 467079.95 mpp[tiflash] ExchangeType: PassThrough", - " └─Projection_38 3.00 467079.93 mpp[tiflash] Column#4", - " └─HashAgg_36 3.00 467079.92 mpp[tiflash] group by:test.t2.a, funcs:count(1)->Column#4", - " └─ExchangeReceiver_22 3.00 464187.20 mpp[tiflash] ", - " └─ExchangeSender_21 3.00 464139.20 mpp[tiflash] ExchangeType: HashPartition, Hash Cols: [name: test.t2.a, collate: binary]", - " └─TableFullScan_20 3.00 464139.20 mpp[tiflash] table:t2 keep order:false" + "HashAgg_8 3.00 209.09 root group by:test.t2.a, funcs:count(1)->Column#4", + "└─TableReader_17 3.00 58.13 root data:TableFullScan_16", + " └─TableFullScan_16 3.00 681.92 cop[tikv] table:t2 keep order:false" ] }, { "SQL": "explain format = 'verbose' select count(*) from t3 where b = 0", "Plan": [ - "StreamAgg_10 1.00 0.00 root funcs:count(1)->Column#4", - "└─IndexReader_15 0.00 0.00 root index:IndexRangeScan_14", - " └─IndexRangeScan_14 0.00 0.00 cop[tikv] table:t3, index:c(b) range:[0,0], keep order:false" + "HashAgg_12 1.00 45.24 root funcs:count(Column#5)->Column#4", + "└─IndexReader_13 1.00 14.98 root index:HashAgg_6", + " └─HashAgg_6 1.00 193.06 cop[tikv] funcs:count(1)->Column#5", + " └─IndexRangeScan_11 0.00 162.80 cop[tikv] table:t3, index:c(b) range:[0,0], keep order:false" ] }, { "SQL": "explain format = 'verbose' select /*+ use_index(t3, c) */ count(a) from t3 where b = 0", "Plan": [ - "StreamAgg_10 1.00 1920.00 root funcs:count(test.t3.a)->Column#4", - "└─IndexLookUp_17 0.00 1920.00 root ", - " ├─IndexRangeScan_15(Build) 0.00 0.00 cop[tikv] table:t3, index:c(b) range:[0,0], keep order:false", - " └─TableRowIDScan_16(Probe) 0.00 0.00 cop[tikv] table:t3 keep order:false" + "HashAgg_13 1.00 1981.96 root funcs:count(Column#6)->Column#4", + "└─IndexLookUp_14 1.00 1951.70 root ", + " ├─IndexRangeScan_11(Build) 0.00 203.50 cop[tikv] table:t3, index:c(b) range:[0,0], keep order:false", + " └─HashAgg_7(Probe) 1.00 257.57 cop[tikv] funcs:count(test.t3.a)->Column#6", + " └─TableRowIDScan_12 0.00 227.31 cop[tikv] table:t3 keep order:false" ] }, { "SQL": "explain format = 'verbose' select count(*) from t2 where a = 0", "Plan": [ - "StreamAgg_12 1.00 55.44 root funcs:count(1)->Column#4", - "└─TableReader_21 0.00 55.44 root data:Selection_20", - " └─Selection_20 0.00 831.62 cop[tikv] eq(test.t2.a, 0)", - " └─TableFullScan_19 3.00 681.92 cop[tikv] table:t2 keep order:false" + "HashAgg_17 1.00 89.83 root funcs:count(Column#5)->Column#4", + "└─TableReader_18 1.00 59.57 root data:HashAgg_7", + " └─HashAgg_7 1.00 861.88 cop[tikv] funcs:count(1)->Column#5", + " └─Selection_14 0.00 831.62 cop[tikv] eq(test.t2.a, 0)", + " └─TableFullScan_13 3.00 681.92 cop[tikv] table:t2 keep order:false" ] }, { "SQL": "explain format = 'verbose' select count(*) from t3 t join t3 on t.a = t3.b", "Plan": [ - "StreamAgg_10 1.00 631.93 root funcs:count(1)->Column#7", - "└─HashJoin_40 3.00 482.23 root inner join, equal:[eq(test.t3.a, test.t3.b)]", + "HashAgg_9 1.00 552.41 root funcs:count(1)->Column#7", + "└─HashJoin_22 3.00 482.23 root inner join, equal:[eq(test.t3.a, test.t3.b)]", " ├─IndexReader_28(Build) 3.00 45.23 root index:IndexFullScan_27", " │ └─IndexFullScan_27 3.00 488.40 cop[tikv] table:t3, index:c(b) keep order:false", " └─TableReader_26(Probe) 3.00 68.11 root data:Selection_25", @@ -2587,23 +2586,24 @@ { "SQL": "explain format = 'verbose' select /*+ read_from_storage(tiflash[t1, t2]) */ count(*) from t1 join t2 on t1.a = t2.a", "Plan": [ - "StreamAgg_15 1.00 62053.22 root funcs:count(1)->Column#7", - "└─TableReader_41 3.00 61903.52 root data:ExchangeSender_40", - " └─ExchangeSender_40 3.00 928447.20 mpp[tiflash] ExchangeType: PassThrough", - " └─HashJoin_37 3.00 928447.20 mpp[tiflash] inner join, equal:[eq(test.t1.a, test.t2.a)]", - " ├─ExchangeReceiver_22(Build) 3.00 464290.40 mpp[tiflash] ", - " │ └─ExchangeSender_21 3.00 464146.40 mpp[tiflash] ExchangeType: Broadcast", - " │ └─Selection_20 3.00 464146.40 mpp[tiflash] not(isnull(test.t1.a))", - " │ └─TableFullScan_19 3.00 464139.20 mpp[tiflash] table:t1 keep order:false", - " └─Selection_24(Probe) 3.00 464146.40 mpp[tiflash] not(isnull(test.t2.a))", - " └─TableFullScan_23 3.00 464139.20 mpp[tiflash] table:t2 keep order:false" + "HashAgg_34 1.00 61928.14 root funcs:count(Column#8)->Column#7", + "└─TableReader_36 1.00 61897.88 root data:ExchangeSender_35", + " └─ExchangeSender_35 1.00 928450.64 mpp[tiflash] ExchangeType: PassThrough", + " └─HashAgg_13 1.00 928450.64 mpp[tiflash] funcs:count(1)->Column#8", + " └─HashJoin_33 3.00 928447.20 mpp[tiflash] inner join, equal:[eq(test.t1.a, test.t2.a)]", + " ├─ExchangeReceiver_22(Build) 3.00 464290.40 mpp[tiflash] ", + " │ └─ExchangeSender_21 3.00 464146.40 mpp[tiflash] ExchangeType: Broadcast", + " │ └─Selection_20 3.00 464146.40 mpp[tiflash] not(isnull(test.t1.a))", + " │ └─TableFullScan_19 3.00 464139.20 mpp[tiflash] table:t1 keep order:false", + " └─Selection_24(Probe) 3.00 464146.40 mpp[tiflash] not(isnull(test.t2.a))", + " └─TableFullScan_23 3.00 464139.20 mpp[tiflash] table:t2 keep order:false" ] }, { "SQL": "explain format = 'verbose' select /*+ read_from_storage(tiflash[t1, t2]) */ count(*) from t1 join t2 on t1.a = t2.a join t3 on t1.b = t3.b", "Plan": [ - "StreamAgg_15 1.00 70216.64 root funcs:count(1)->Column#10", - "└─HashJoin_59 3.00 70066.94 root inner join, equal:[eq(test.t1.b, test.t3.b)]", + "HashAgg_14 1.00 70137.12 root funcs:count(1)->Column#10", + "└─HashJoin_27 3.00 70066.94 root inner join, equal:[eq(test.t1.b, test.t3.b)]", " ├─IndexReader_47(Build) 3.00 45.23 root index:IndexFullScan_46", " │ └─IndexFullScan_46 3.00 488.40 cop[tikv] table:t3, index:c(b) keep order:false", " └─TableReader_39(Probe) 3.00 69652.83 root data:ExchangeSender_38", @@ -2620,11 +2620,13 @@ { "SQL": "explain format = 'verbose' select (2) in (select /*+ read_from_storage(tiflash[t1]) */ count(*) from t1) from (select t.b < (select /*+ read_from_storage(tiflash[t2]) */ t.b from t2 limit 1 ) from t3 t) t", "Plan": [ - "HashJoin_19 3.00 160874.64 root CARTESIAN left outer semi join", - "├─Selection_38(Build) 0.80 31154.89 root eq(2, Column#18)", - "│ └─StreamAgg_45 1.00 31104.99 root funcs:count(1)->Column#18", - "│ └─TableReader_59 3.00 30955.29 root data:TableFullScan_58", - "│ └─TableFullScan_58 3.00 464139.20 cop[tiflash] table:t1 keep order:false", + "HashJoin_19 3.00 160743.93 root CARTESIAN left outer semi join", + "├─Selection_38(Build) 0.80 31024.18 root eq(2, Column#18)", + "│ └─HashAgg_52 1.00 30974.28 root funcs:count(Column#31)->Column#18", + "│ └─TableReader_54 1.00 30944.02 root data:ExchangeSender_53", + "│ └─ExchangeSender_53 1.00 464142.64 mpp[tiflash] ExchangeType: PassThrough", + "│ └─HashAgg_43 1.00 464142.64 mpp[tiflash] funcs:count(1)->Column#31", + "│ └─TableFullScan_51 3.00 464139.20 mpp[tiflash] table:t1 keep order:false", "└─Projection_20(Probe) 3.00 129648.62 root 1->Column#28", " └─Apply_22 3.00 129648.32 root CARTESIAN left outer join", " ├─IndexReader_26(Build) 3.00 53.37 root index:IndexFullScan_25", @@ -2640,8 +2642,8 @@ { "SQL": "explain format = 'verbose' select /*+ merge_join(t1), read_from_storage(tiflash[t1, t2]) */ count(*) from t1 join t2 on t1.a = t2.a", "Plan": [ - "StreamAgg_14 1.00 62557.96 root funcs:count(1)->Column#7", - "└─MergeJoin_26 3.00 62408.26 root inner join, left key:test.t1.a, right key:test.t2.a", + "HashAgg_11 1.00 62478.44 root funcs:count(1)->Column#7", + "└─MergeJoin_16 3.00 62408.26 root inner join, left key:test.t1.a, right key:test.t2.a", " ├─Sort_24(Build) 3.00 31202.63 root test.t2.a", " │ └─TableReader_23 3.00 30955.77 root data:Selection_22", " │ └─Selection_22 3.00 464146.40 cop[tiflash] not(isnull(test.t2.a))", @@ -2951,301 +2953,322 @@ { "SQL": "explain format = 'brief' select count(*) from fact_t, d1_t where fact_t.d1_k = d1_t.d1_k", "Plan": [ - "StreamAgg 1.00 root funcs:count(1)->Column#11", - "└─TableReader 8.00 root data:ExchangeSender", - " └─ExchangeSender 8.00 mpp[tiflash] ExchangeType: PassThrough", - " └─HashJoin 8.00 mpp[tiflash] inner join, equal:[eq(test.d1_t.d1_k, test.fact_t.d1_k)]", - " ├─ExchangeReceiver(Build) 2.00 mpp[tiflash] ", - " │ └─ExchangeSender 2.00 mpp[tiflash] ExchangeType: Broadcast", - " │ └─Selection 2.00 mpp[tiflash] not(isnull(test.d1_t.d1_k))", - " │ └─TableFullScan 2.00 mpp[tiflash] table:d1_t keep order:false", - " └─Selection(Probe) 8.00 mpp[tiflash] not(isnull(test.fact_t.d1_k))", - " └─TableFullScan 8.00 mpp[tiflash] table:fact_t keep order:false" + "HashAgg 1.00 root funcs:count(Column#12)->Column#11", + "└─TableReader 1.00 root data:ExchangeSender", + " └─ExchangeSender 1.00 mpp[tiflash] ExchangeType: PassThrough", + " └─HashAgg 1.00 mpp[tiflash] funcs:count(1)->Column#12", + " └─HashJoin 8.00 mpp[tiflash] inner join, equal:[eq(test.d1_t.d1_k, test.fact_t.d1_k)]", + " ├─ExchangeReceiver(Build) 2.00 mpp[tiflash] ", + " │ └─ExchangeSender 2.00 mpp[tiflash] ExchangeType: Broadcast", + " │ └─Selection 2.00 mpp[tiflash] not(isnull(test.d1_t.d1_k))", + " │ └─TableFullScan 2.00 mpp[tiflash] table:d1_t keep order:false", + " └─Selection(Probe) 8.00 mpp[tiflash] not(isnull(test.fact_t.d1_k))", + " └─TableFullScan 8.00 mpp[tiflash] table:fact_t keep order:false" ] }, { "SQL": "explain format = 'brief' select count(*) from fact_t, d1_t, d2_t, d3_t where fact_t.d1_k = d1_t.d1_k and fact_t.d2_k = d2_t.d2_k and fact_t.d3_k = d3_t.d3_k", "Plan": [ - "StreamAgg 1.00 root funcs:count(1)->Column#17", - "└─TableReader 8.00 root data:ExchangeSender", - " └─ExchangeSender 8.00 mpp[tiflash] ExchangeType: PassThrough", - " └─HashJoin 8.00 mpp[tiflash] inner join, equal:[eq(test.fact_t.d3_k, test.d3_t.d3_k)]", - " ├─ExchangeReceiver(Build) 2.00 mpp[tiflash] ", - " │ └─ExchangeSender 2.00 mpp[tiflash] ExchangeType: Broadcast", - " │ └─Selection 2.00 mpp[tiflash] not(isnull(test.d3_t.d3_k))", - " │ └─TableFullScan 2.00 mpp[tiflash] table:d3_t keep order:false", - " └─HashJoin(Probe) 8.00 mpp[tiflash] inner join, equal:[eq(test.fact_t.d2_k, test.d2_t.d2_k)]", + "HashAgg 1.00 root funcs:count(Column#18)->Column#17", + "└─TableReader 1.00 root data:ExchangeSender", + " └─ExchangeSender 1.00 mpp[tiflash] ExchangeType: PassThrough", + " └─HashAgg 1.00 mpp[tiflash] funcs:count(1)->Column#18", + " └─HashJoin 8.00 mpp[tiflash] inner join, equal:[eq(test.fact_t.d3_k, test.d3_t.d3_k)]", " ├─ExchangeReceiver(Build) 2.00 mpp[tiflash] ", " │ └─ExchangeSender 2.00 mpp[tiflash] ExchangeType: Broadcast", - " │ └─Selection 2.00 mpp[tiflash] not(isnull(test.d2_t.d2_k))", - " │ └─TableFullScan 2.00 mpp[tiflash] table:d2_t keep order:false", - " └─HashJoin(Probe) 8.00 mpp[tiflash] inner join, equal:[eq(test.d1_t.d1_k, test.fact_t.d1_k)]", + " │ └─Selection 2.00 mpp[tiflash] not(isnull(test.d3_t.d3_k))", + " │ └─TableFullScan 2.00 mpp[tiflash] table:d3_t keep order:false", + " └─HashJoin(Probe) 8.00 mpp[tiflash] inner join, equal:[eq(test.fact_t.d2_k, test.d2_t.d2_k)]", " ├─ExchangeReceiver(Build) 2.00 mpp[tiflash] ", " │ └─ExchangeSender 2.00 mpp[tiflash] ExchangeType: Broadcast", - " │ └─Selection 2.00 mpp[tiflash] not(isnull(test.d1_t.d1_k))", - " │ └─TableFullScan 2.00 mpp[tiflash] table:d1_t keep order:false", - " └─Selection(Probe) 8.00 mpp[tiflash] not(isnull(test.fact_t.d1_k)), not(isnull(test.fact_t.d2_k)), not(isnull(test.fact_t.d3_k))", - " └─TableFullScan 8.00 mpp[tiflash] table:fact_t keep order:false" + " │ └─Selection 2.00 mpp[tiflash] not(isnull(test.d2_t.d2_k))", + " │ └─TableFullScan 2.00 mpp[tiflash] table:d2_t keep order:false", + " └─HashJoin(Probe) 8.00 mpp[tiflash] inner join, equal:[eq(test.d1_t.d1_k, test.fact_t.d1_k)]", + " ├─ExchangeReceiver(Build) 2.00 mpp[tiflash] ", + " │ └─ExchangeSender 2.00 mpp[tiflash] ExchangeType: Broadcast", + " │ └─Selection 2.00 mpp[tiflash] not(isnull(test.d1_t.d1_k))", + " │ └─TableFullScan 2.00 mpp[tiflash] table:d1_t keep order:false", + " └─Selection(Probe) 8.00 mpp[tiflash] not(isnull(test.fact_t.d1_k)), not(isnull(test.fact_t.d2_k)), not(isnull(test.fact_t.d3_k))", + " └─TableFullScan 8.00 mpp[tiflash] table:fact_t keep order:false" ] }, { "SQL": "explain format = 'brief' select count(*) from fact_t, d1_t where fact_t.d1_k = d1_t.d1_k", "Plan": [ - "StreamAgg 1.00 root funcs:count(1)->Column#11", - "└─TableReader 8.00 root data:ExchangeSender", - " └─ExchangeSender 8.00 mpp[tiflash] ExchangeType: PassThrough", - " └─HashJoin 8.00 mpp[tiflash] inner join, equal:[eq(test.d1_t.d1_k, test.fact_t.d1_k)]", - " ├─ExchangeReceiver(Build) 2.00 mpp[tiflash] ", - " │ └─ExchangeSender 2.00 mpp[tiflash] ExchangeType: Broadcast", - " │ └─Selection 2.00 mpp[tiflash] not(isnull(test.d1_t.d1_k))", - " │ └─TableFullScan 2.00 mpp[tiflash] table:d1_t keep order:false", - " └─Selection(Probe) 8.00 mpp[tiflash] not(isnull(test.fact_t.d1_k))", - " └─TableFullScan 8.00 mpp[tiflash] table:fact_t keep order:false" + "HashAgg 1.00 root funcs:count(Column#12)->Column#11", + "└─TableReader 1.00 root data:ExchangeSender", + " └─ExchangeSender 1.00 mpp[tiflash] ExchangeType: PassThrough", + " └─HashAgg 1.00 mpp[tiflash] funcs:count(1)->Column#12", + " └─HashJoin 8.00 mpp[tiflash] inner join, equal:[eq(test.d1_t.d1_k, test.fact_t.d1_k)]", + " ├─ExchangeReceiver(Build) 2.00 mpp[tiflash] ", + " │ └─ExchangeSender 2.00 mpp[tiflash] ExchangeType: Broadcast", + " │ └─Selection 2.00 mpp[tiflash] not(isnull(test.d1_t.d1_k))", + " │ └─TableFullScan 2.00 mpp[tiflash] table:d1_t keep order:false", + " └─Selection(Probe) 8.00 mpp[tiflash] not(isnull(test.fact_t.d1_k))", + " └─TableFullScan 8.00 mpp[tiflash] table:fact_t keep order:false" ] }, { "SQL": "explain format = 'brief' select count(*) from fact_t left join d1_t on fact_t.d1_k = d1_t.d1_k", "Plan": [ - "StreamAgg 1.00 root funcs:count(1)->Column#11", - "└─TableReader 8.00 root data:ExchangeSender", - " └─ExchangeSender 8.00 mpp[tiflash] ExchangeType: PassThrough", - " └─HashJoin 8.00 mpp[tiflash] left outer join, equal:[eq(test.fact_t.d1_k, test.d1_t.d1_k)]", - " ├─ExchangeReceiver(Build) 2.00 mpp[tiflash] ", - " │ └─ExchangeSender 2.00 mpp[tiflash] ExchangeType: Broadcast", - " │ └─Selection 2.00 mpp[tiflash] not(isnull(test.d1_t.d1_k))", - " │ └─TableFullScan 2.00 mpp[tiflash] table:d1_t keep order:false", - " └─TableFullScan(Probe) 8.00 mpp[tiflash] table:fact_t keep order:false" + "HashAgg 1.00 root funcs:count(Column#12)->Column#11", + "└─TableReader 1.00 root data:ExchangeSender", + " └─ExchangeSender 1.00 mpp[tiflash] ExchangeType: PassThrough", + " └─HashAgg 1.00 mpp[tiflash] funcs:count(1)->Column#12", + " └─HashJoin 8.00 mpp[tiflash] left outer join, equal:[eq(test.fact_t.d1_k, test.d1_t.d1_k)]", + " ├─ExchangeReceiver(Build) 2.00 mpp[tiflash] ", + " │ └─ExchangeSender 2.00 mpp[tiflash] ExchangeType: Broadcast", + " │ └─Selection 2.00 mpp[tiflash] not(isnull(test.d1_t.d1_k))", + " │ └─TableFullScan 2.00 mpp[tiflash] table:d1_t keep order:false", + " └─TableFullScan(Probe) 8.00 mpp[tiflash] table:fact_t keep order:false" ] }, { "SQL": "explain format = 'brief' select count(*) from fact_t right join d1_t on fact_t.d1_k = d1_t.d1_k", "Plan": [ - "StreamAgg 1.00 root funcs:count(1)->Column#11", - "└─TableReader 8.00 root data:ExchangeSender", - " └─ExchangeSender 8.00 mpp[tiflash] ExchangeType: PassThrough", - " └─HashJoin 8.00 mpp[tiflash] right outer join, equal:[eq(test.fact_t.d1_k, test.d1_t.d1_k)]", - " ├─ExchangeReceiver(Build) 8.00 mpp[tiflash] ", - " │ └─ExchangeSender 8.00 mpp[tiflash] ExchangeType: Broadcast", - " │ └─Selection 8.00 mpp[tiflash] not(isnull(test.fact_t.d1_k))", - " │ └─TableFullScan 8.00 mpp[tiflash] table:fact_t keep order:false", - " └─TableFullScan(Probe) 2.00 mpp[tiflash] table:d1_t keep order:false" + "HashAgg 1.00 root funcs:count(Column#12)->Column#11", + "└─TableReader 1.00 root data:ExchangeSender", + " └─ExchangeSender 1.00 mpp[tiflash] ExchangeType: PassThrough", + " └─HashAgg 1.00 mpp[tiflash] funcs:count(1)->Column#12", + " └─HashJoin 8.00 mpp[tiflash] right outer join, equal:[eq(test.fact_t.d1_k, test.d1_t.d1_k)]", + " ├─ExchangeReceiver(Build) 8.00 mpp[tiflash] ", + " │ └─ExchangeSender 8.00 mpp[tiflash] ExchangeType: Broadcast", + " │ └─Selection 8.00 mpp[tiflash] not(isnull(test.fact_t.d1_k))", + " │ └─TableFullScan 8.00 mpp[tiflash] table:fact_t keep order:false", + " └─TableFullScan(Probe) 2.00 mpp[tiflash] table:d1_t keep order:false" ] }, { "SQL": "explain format = 'brief' select count(*) from fact_t join d1_t on fact_t.d1_k = d1_t.d1_k and fact_t.col1 > d1_t.value", "Plan": [ - "StreamAgg 1.00 root funcs:count(1)->Column#11", - "└─TableReader 8.00 root data:ExchangeSender", - " └─ExchangeSender 8.00 mpp[tiflash] ExchangeType: PassThrough", - " └─HashJoin 8.00 mpp[tiflash] inner join, equal:[eq(test.d1_t.d1_k, test.fact_t.d1_k)], other cond:gt(test.fact_t.col1, test.d1_t.value)", - " ├─ExchangeReceiver(Build) 2.00 mpp[tiflash] ", - " │ └─ExchangeSender 2.00 mpp[tiflash] ExchangeType: Broadcast", - " │ └─Selection 2.00 mpp[tiflash] not(isnull(test.d1_t.d1_k)), not(isnull(test.d1_t.value))", - " │ └─TableFullScan 2.00 mpp[tiflash] table:d1_t keep order:false", - " └─Selection(Probe) 8.00 mpp[tiflash] not(isnull(test.fact_t.col1)), not(isnull(test.fact_t.d1_k))", - " └─TableFullScan 8.00 mpp[tiflash] table:fact_t keep order:false" + "HashAgg 1.00 root funcs:count(Column#12)->Column#11", + "└─TableReader 1.00 root data:ExchangeSender", + " └─ExchangeSender 1.00 mpp[tiflash] ExchangeType: PassThrough", + " └─HashAgg 1.00 mpp[tiflash] funcs:count(1)->Column#12", + " └─HashJoin 8.00 mpp[tiflash] inner join, equal:[eq(test.d1_t.d1_k, test.fact_t.d1_k)], other cond:gt(test.fact_t.col1, test.d1_t.value)", + " ├─ExchangeReceiver(Build) 2.00 mpp[tiflash] ", + " │ └─ExchangeSender 2.00 mpp[tiflash] ExchangeType: Broadcast", + " │ └─Selection 2.00 mpp[tiflash] not(isnull(test.d1_t.d1_k)), not(isnull(test.d1_t.value))", + " │ └─TableFullScan 2.00 mpp[tiflash] table:d1_t keep order:false", + " └─Selection(Probe) 8.00 mpp[tiflash] not(isnull(test.fact_t.col1)), not(isnull(test.fact_t.d1_k))", + " └─TableFullScan 8.00 mpp[tiflash] table:fact_t keep order:false" ] }, { "SQL": "explain format = 'brief' select count(*) from fact_t left join d1_t on fact_t.d1_k = d1_t.d1_k and fact_t.col1 > 10", "Plan": [ - "StreamAgg 1.00 root funcs:count(1)->Column#11", - "└─TableReader 8.00 root data:ExchangeSender", - " └─ExchangeSender 8.00 mpp[tiflash] ExchangeType: PassThrough", - " └─HashJoin 8.00 mpp[tiflash] left outer join, equal:[eq(test.fact_t.d1_k, test.d1_t.d1_k)], left cond:[gt(test.fact_t.col1, 10)]", - " ├─ExchangeReceiver(Build) 2.00 mpp[tiflash] ", - " │ └─ExchangeSender 2.00 mpp[tiflash] ExchangeType: Broadcast", - " │ └─Selection 2.00 mpp[tiflash] not(isnull(test.d1_t.d1_k))", - " │ └─TableFullScan 2.00 mpp[tiflash] table:d1_t keep order:false", - " └─TableFullScan(Probe) 8.00 mpp[tiflash] table:fact_t keep order:false" + "HashAgg 1.00 root funcs:count(Column#12)->Column#11", + "└─TableReader 1.00 root data:ExchangeSender", + " └─ExchangeSender 1.00 mpp[tiflash] ExchangeType: PassThrough", + " └─HashAgg 1.00 mpp[tiflash] funcs:count(1)->Column#12", + " └─HashJoin 8.00 mpp[tiflash] left outer join, equal:[eq(test.fact_t.d1_k, test.d1_t.d1_k)], left cond:[gt(test.fact_t.col1, 10)]", + " ├─ExchangeReceiver(Build) 2.00 mpp[tiflash] ", + " │ └─ExchangeSender 2.00 mpp[tiflash] ExchangeType: Broadcast", + " │ └─Selection 2.00 mpp[tiflash] not(isnull(test.d1_t.d1_k))", + " │ └─TableFullScan 2.00 mpp[tiflash] table:d1_t keep order:false", + " └─TableFullScan(Probe) 8.00 mpp[tiflash] table:fact_t keep order:false" ] }, { "SQL": "explain format = 'brief' select count(*) from fact_t left join d1_t on fact_t.d1_k = d1_t.d1_k and fact_t.col2 > 10 and fact_t.col1 > d1_t.value", "Plan": [ - "StreamAgg 1.00 root funcs:count(1)->Column#11", - "└─TableReader 8.00 root data:ExchangeSender", - " └─ExchangeSender 8.00 mpp[tiflash] ExchangeType: PassThrough", - " └─HashJoin 8.00 mpp[tiflash] left outer join, equal:[eq(test.fact_t.d1_k, test.d1_t.d1_k)], left cond:[gt(test.fact_t.col2, 10)], other cond:gt(test.fact_t.col1, test.d1_t.value)", - " ├─ExchangeReceiver(Build) 2.00 mpp[tiflash] ", - " │ └─ExchangeSender 2.00 mpp[tiflash] ExchangeType: Broadcast", - " │ └─Selection 2.00 mpp[tiflash] not(isnull(test.d1_t.d1_k)), not(isnull(test.d1_t.value))", - " │ └─TableFullScan 2.00 mpp[tiflash] table:d1_t keep order:false", - " └─TableFullScan(Probe) 8.00 mpp[tiflash] table:fact_t keep order:false" + "HashAgg 1.00 root funcs:count(Column#12)->Column#11", + "└─TableReader 1.00 root data:ExchangeSender", + " └─ExchangeSender 1.00 mpp[tiflash] ExchangeType: PassThrough", + " └─HashAgg 1.00 mpp[tiflash] funcs:count(1)->Column#12", + " └─HashJoin 8.00 mpp[tiflash] left outer join, equal:[eq(test.fact_t.d1_k, test.d1_t.d1_k)], left cond:[gt(test.fact_t.col2, 10)], other cond:gt(test.fact_t.col1, test.d1_t.value)", + " ├─ExchangeReceiver(Build) 2.00 mpp[tiflash] ", + " │ └─ExchangeSender 2.00 mpp[tiflash] ExchangeType: Broadcast", + " │ └─Selection 2.00 mpp[tiflash] not(isnull(test.d1_t.d1_k)), not(isnull(test.d1_t.value))", + " │ └─TableFullScan 2.00 mpp[tiflash] table:d1_t keep order:false", + " └─TableFullScan(Probe) 8.00 mpp[tiflash] table:fact_t keep order:false" ] }, { "SQL": "explain format = 'brief' select count(*) from fact_t right join d1_t on fact_t.d1_k = d1_t.d1_k and d1_t.value > 10", "Plan": [ - "StreamAgg 1.00 root funcs:count(1)->Column#11", - "└─TableReader 8.00 root data:ExchangeSender", - " └─ExchangeSender 8.00 mpp[tiflash] ExchangeType: PassThrough", - " └─HashJoin 8.00 mpp[tiflash] right outer join, equal:[eq(test.fact_t.d1_k, test.d1_t.d1_k)], right cond:gt(test.d1_t.value, 10)", - " ├─ExchangeReceiver(Build) 8.00 mpp[tiflash] ", - " │ └─ExchangeSender 8.00 mpp[tiflash] ExchangeType: Broadcast", - " │ └─Selection 8.00 mpp[tiflash] not(isnull(test.fact_t.d1_k))", - " │ └─TableFullScan 8.00 mpp[tiflash] table:fact_t keep order:false", - " └─TableFullScan(Probe) 2.00 mpp[tiflash] table:d1_t keep order:false" + "HashAgg 1.00 root funcs:count(Column#12)->Column#11", + "└─TableReader 1.00 root data:ExchangeSender", + " └─ExchangeSender 1.00 mpp[tiflash] ExchangeType: PassThrough", + " └─HashAgg 1.00 mpp[tiflash] funcs:count(1)->Column#12", + " └─HashJoin 8.00 mpp[tiflash] right outer join, equal:[eq(test.fact_t.d1_k, test.d1_t.d1_k)], right cond:gt(test.d1_t.value, 10)", + " ├─ExchangeReceiver(Build) 8.00 mpp[tiflash] ", + " │ └─ExchangeSender 8.00 mpp[tiflash] ExchangeType: Broadcast", + " │ └─Selection 8.00 mpp[tiflash] not(isnull(test.fact_t.d1_k))", + " │ └─TableFullScan 8.00 mpp[tiflash] table:fact_t keep order:false", + " └─TableFullScan(Probe) 2.00 mpp[tiflash] table:d1_t keep order:false" ] }, { "SQL": "explain format = 'brief' select count(*) from fact_t right join d1_t on fact_t.d1_k = d1_t.d1_k and d1_t.value > 10 and fact_t.col1 > d1_t.value", "Plan": [ - "StreamAgg 1.00 root funcs:count(1)->Column#11", - "└─TableReader 8.00 root data:ExchangeSender", - " └─ExchangeSender 8.00 mpp[tiflash] ExchangeType: PassThrough", - " └─HashJoin 8.00 mpp[tiflash] right outer join, equal:[eq(test.fact_t.d1_k, test.d1_t.d1_k)], right cond:gt(test.d1_t.value, 10), other cond:gt(test.fact_t.col1, test.d1_t.value)", - " ├─ExchangeReceiver(Build) 8.00 mpp[tiflash] ", - " │ └─ExchangeSender 8.00 mpp[tiflash] ExchangeType: Broadcast", - " │ └─Selection 8.00 mpp[tiflash] not(isnull(test.fact_t.col1)), not(isnull(test.fact_t.d1_k))", - " │ └─TableFullScan 8.00 mpp[tiflash] table:fact_t keep order:false", - " └─TableFullScan(Probe) 2.00 mpp[tiflash] table:d1_t keep order:false" + "HashAgg 1.00 root funcs:count(Column#12)->Column#11", + "└─TableReader 1.00 root data:ExchangeSender", + " └─ExchangeSender 1.00 mpp[tiflash] ExchangeType: PassThrough", + " └─HashAgg 1.00 mpp[tiflash] funcs:count(1)->Column#12", + " └─HashJoin 8.00 mpp[tiflash] right outer join, equal:[eq(test.fact_t.d1_k, test.d1_t.d1_k)], right cond:gt(test.d1_t.value, 10), other cond:gt(test.fact_t.col1, test.d1_t.value)", + " ├─ExchangeReceiver(Build) 8.00 mpp[tiflash] ", + " │ └─ExchangeSender 8.00 mpp[tiflash] ExchangeType: Broadcast", + " │ └─Selection 8.00 mpp[tiflash] not(isnull(test.fact_t.col1)), not(isnull(test.fact_t.d1_k))", + " │ └─TableFullScan 8.00 mpp[tiflash] table:fact_t keep order:false", + " └─TableFullScan(Probe) 2.00 mpp[tiflash] table:d1_t keep order:false" ] }, { "SQL": "explain format = 'brief' select count(*) from fact_t where exists (select 1 from d1_t where d1_k = fact_t.d1_k)", "Plan": [ - "StreamAgg 1.00 root funcs:count(1)->Column#12", - "└─TableReader 6.40 root data:ExchangeSender", - " └─ExchangeSender 6.40 mpp[tiflash] ExchangeType: PassThrough", - " └─HashJoin 6.40 mpp[tiflash] semi join, equal:[eq(test.fact_t.d1_k, test.d1_t.d1_k)]", - " ├─ExchangeReceiver(Build) 2.00 mpp[tiflash] ", - " │ └─ExchangeSender 2.00 mpp[tiflash] ExchangeType: Broadcast", - " │ └─Selection 2.00 mpp[tiflash] not(isnull(test.d1_t.d1_k))", - " │ └─TableFullScan 2.00 mpp[tiflash] table:d1_t keep order:false", - " └─Selection(Probe) 8.00 mpp[tiflash] not(isnull(test.fact_t.d1_k))", - " └─TableFullScan 8.00 mpp[tiflash] table:fact_t keep order:false" + "HashAgg 1.00 root funcs:count(Column#13)->Column#12", + "└─TableReader 1.00 root data:ExchangeSender", + " └─ExchangeSender 1.00 mpp[tiflash] ExchangeType: PassThrough", + " └─HashAgg 1.00 mpp[tiflash] funcs:count(1)->Column#13", + " └─HashJoin 6.40 mpp[tiflash] semi join, equal:[eq(test.fact_t.d1_k, test.d1_t.d1_k)]", + " ├─ExchangeReceiver(Build) 2.00 mpp[tiflash] ", + " │ └─ExchangeSender 2.00 mpp[tiflash] ExchangeType: Broadcast", + " │ └─Selection 2.00 mpp[tiflash] not(isnull(test.d1_t.d1_k))", + " │ └─TableFullScan 2.00 mpp[tiflash] table:d1_t keep order:false", + " └─Selection(Probe) 8.00 mpp[tiflash] not(isnull(test.fact_t.d1_k))", + " └─TableFullScan 8.00 mpp[tiflash] table:fact_t keep order:false" ] }, { "SQL": "explain format = 'brief' select count(*) from fact_t where exists (select 1 from d1_t where d1_k = fact_t.d1_k and value > fact_t.col1)", "Plan": [ - "StreamAgg 1.00 root funcs:count(1)->Column#12", - "└─TableReader 6.40 root data:ExchangeSender", - " └─ExchangeSender 6.40 mpp[tiflash] ExchangeType: PassThrough", - " └─HashJoin 6.40 mpp[tiflash] semi join, equal:[eq(test.fact_t.d1_k, test.d1_t.d1_k)], other cond:gt(test.d1_t.value, test.fact_t.col1)", - " ├─ExchangeReceiver(Build) 2.00 mpp[tiflash] ", - " │ └─ExchangeSender 2.00 mpp[tiflash] ExchangeType: Broadcast", - " │ └─Selection 2.00 mpp[tiflash] not(isnull(test.d1_t.d1_k)), not(isnull(test.d1_t.value))", - " │ └─TableFullScan 2.00 mpp[tiflash] table:d1_t keep order:false", - " └─Selection(Probe) 8.00 mpp[tiflash] not(isnull(test.fact_t.col1)), not(isnull(test.fact_t.d1_k))", - " └─TableFullScan 8.00 mpp[tiflash] table:fact_t keep order:false" + "HashAgg 1.00 root funcs:count(Column#13)->Column#12", + "└─TableReader 1.00 root data:ExchangeSender", + " └─ExchangeSender 1.00 mpp[tiflash] ExchangeType: PassThrough", + " └─HashAgg 1.00 mpp[tiflash] funcs:count(1)->Column#13", + " └─HashJoin 6.40 mpp[tiflash] semi join, equal:[eq(test.fact_t.d1_k, test.d1_t.d1_k)], other cond:gt(test.d1_t.value, test.fact_t.col1)", + " ├─ExchangeReceiver(Build) 2.00 mpp[tiflash] ", + " │ └─ExchangeSender 2.00 mpp[tiflash] ExchangeType: Broadcast", + " │ └─Selection 2.00 mpp[tiflash] not(isnull(test.d1_t.d1_k)), not(isnull(test.d1_t.value))", + " │ └─TableFullScan 2.00 mpp[tiflash] table:d1_t keep order:false", + " └─Selection(Probe) 8.00 mpp[tiflash] not(isnull(test.fact_t.col1)), not(isnull(test.fact_t.d1_k))", + " └─TableFullScan 8.00 mpp[tiflash] table:fact_t keep order:false" ] }, { "SQL": "explain format = 'brief' select count(*) from fact_t where exists (select /*+ SEMI_JOIN_REWRITE() */ 1 from d1_t where d1_k = fact_t.d1_k)", "Plan": [ - "StreamAgg 1.00 root funcs:count(1)->Column#12", - "└─TableReader 8.00 root data:ExchangeSender", - " └─ExchangeSender 8.00 mpp[tiflash] ExchangeType: PassThrough", - " └─HashJoin 8.00 mpp[tiflash] inner join, equal:[eq(test.fact_t.d1_k, test.d1_t.d1_k)]", - " ├─ExchangeReceiver(Build) 2.00 mpp[tiflash] ", - " │ └─ExchangeSender 2.00 mpp[tiflash] ExchangeType: Broadcast", - " │ └─Projection 2.00 mpp[tiflash] test.d1_t.d1_k", - " │ └─HashAgg 2.00 mpp[tiflash] group by:test.d1_t.d1_k, funcs:firstrow(test.d1_t.d1_k)->test.d1_t.d1_k", - " │ └─ExchangeReceiver 2.00 mpp[tiflash] ", - " │ └─ExchangeSender 2.00 mpp[tiflash] ExchangeType: HashPartition, Hash Cols: [name: test.d1_t.d1_k, collate: binary]", - " │ └─Selection 2.00 mpp[tiflash] not(isnull(test.d1_t.d1_k))", - " │ └─TableFullScan 2.00 mpp[tiflash] table:d1_t keep order:false", - " └─Selection(Probe) 8.00 mpp[tiflash] not(isnull(test.fact_t.d1_k))", - " └─TableFullScan 8.00 mpp[tiflash] table:fact_t keep order:false" + "HashAgg 1.00 root funcs:count(Column#17)->Column#12", + "└─TableReader 1.00 root data:ExchangeSender", + " └─ExchangeSender 1.00 mpp[tiflash] ExchangeType: PassThrough", + " └─HashAgg 1.00 mpp[tiflash] funcs:count(1)->Column#17", + " └─HashJoin 8.00 mpp[tiflash] inner join, equal:[eq(test.fact_t.d1_k, test.d1_t.d1_k)]", + " ├─ExchangeReceiver(Build) 2.00 mpp[tiflash] ", + " │ └─ExchangeSender 2.00 mpp[tiflash] ExchangeType: Broadcast", + " │ └─Projection 2.00 mpp[tiflash] test.d1_t.d1_k", + " │ └─HashAgg 2.00 mpp[tiflash] group by:test.d1_t.d1_k, funcs:firstrow(test.d1_t.d1_k)->test.d1_t.d1_k", + " │ └─ExchangeReceiver 2.00 mpp[tiflash] ", + " │ └─ExchangeSender 2.00 mpp[tiflash] ExchangeType: HashPartition, Hash Cols: [name: test.d1_t.d1_k, collate: binary]", + " │ └─HashAgg 2.00 mpp[tiflash] group by:test.d1_t.d1_k, ", + " │ └─Selection 2.00 mpp[tiflash] not(isnull(test.d1_t.d1_k))", + " │ └─TableFullScan 2.00 mpp[tiflash] table:d1_t keep order:false", + " └─Selection(Probe) 8.00 mpp[tiflash] not(isnull(test.fact_t.d1_k))", + " └─TableFullScan 8.00 mpp[tiflash] table:fact_t keep order:false" ] }, { "SQL": "explain format = 'brief' select count(*) from fact_t where exists (select /*+ SEMI_JOIN_REWRITE() */ 1 from d1_t where d1_k = fact_t.d1_k and value > fact_t.col1)", "Plan": [ - "StreamAgg 1.00 root funcs:count(1)->Column#12", - "└─TableReader 6.40 root data:ExchangeSender", - " └─ExchangeSender 6.40 mpp[tiflash] ExchangeType: PassThrough", - " └─HashJoin 6.40 mpp[tiflash] semi join, equal:[eq(test.fact_t.d1_k, test.d1_t.d1_k)], other cond:gt(test.d1_t.value, test.fact_t.col1)", - " ├─ExchangeReceiver(Build) 2.00 mpp[tiflash] ", - " │ └─ExchangeSender 2.00 mpp[tiflash] ExchangeType: Broadcast", - " │ └─Selection 2.00 mpp[tiflash] not(isnull(test.d1_t.d1_k)), not(isnull(test.d1_t.value))", - " │ └─TableFullScan 2.00 mpp[tiflash] table:d1_t keep order:false", - " └─Selection(Probe) 8.00 mpp[tiflash] not(isnull(test.fact_t.col1)), not(isnull(test.fact_t.d1_k))", - " └─TableFullScan 8.00 mpp[tiflash] table:fact_t keep order:false" + "HashAgg 1.00 root funcs:count(Column#13)->Column#12", + "└─TableReader 1.00 root data:ExchangeSender", + " └─ExchangeSender 1.00 mpp[tiflash] ExchangeType: PassThrough", + " └─HashAgg 1.00 mpp[tiflash] funcs:count(1)->Column#13", + " └─HashJoin 6.40 mpp[tiflash] semi join, equal:[eq(test.fact_t.d1_k, test.d1_t.d1_k)], other cond:gt(test.d1_t.value, test.fact_t.col1)", + " ├─ExchangeReceiver(Build) 2.00 mpp[tiflash] ", + " │ └─ExchangeSender 2.00 mpp[tiflash] ExchangeType: Broadcast", + " │ └─Selection 2.00 mpp[tiflash] not(isnull(test.d1_t.d1_k)), not(isnull(test.d1_t.value))", + " │ └─TableFullScan 2.00 mpp[tiflash] table:d1_t keep order:false", + " └─Selection(Probe) 8.00 mpp[tiflash] not(isnull(test.fact_t.col1)), not(isnull(test.fact_t.d1_k))", + " └─TableFullScan 8.00 mpp[tiflash] table:fact_t keep order:false" ] }, { "SQL": "explain format = 'brief' select count(*) from fact_t where not exists (select 1 from d1_t where d1_k = fact_t.d1_k)", "Plan": [ - "StreamAgg 1.00 root funcs:count(1)->Column#12", - "└─TableReader 6.40 root data:ExchangeSender", - " └─ExchangeSender 6.40 mpp[tiflash] ExchangeType: PassThrough", - " └─HashJoin 6.40 mpp[tiflash] anti semi join, equal:[eq(test.fact_t.d1_k, test.d1_t.d1_k)]", - " ├─ExchangeReceiver(Build) 2.00 mpp[tiflash] ", - " │ └─ExchangeSender 2.00 mpp[tiflash] ExchangeType: Broadcast", - " │ └─TableFullScan 2.00 mpp[tiflash] table:d1_t keep order:false", - " └─TableFullScan(Probe) 8.00 mpp[tiflash] table:fact_t keep order:false" + "HashAgg 1.00 root funcs:count(Column#13)->Column#12", + "└─TableReader 1.00 root data:ExchangeSender", + " └─ExchangeSender 1.00 mpp[tiflash] ExchangeType: PassThrough", + " └─HashAgg 1.00 mpp[tiflash] funcs:count(1)->Column#13", + " └─HashJoin 6.40 mpp[tiflash] anti semi join, equal:[eq(test.fact_t.d1_k, test.d1_t.d1_k)]", + " ├─ExchangeReceiver(Build) 2.00 mpp[tiflash] ", + " │ └─ExchangeSender 2.00 mpp[tiflash] ExchangeType: Broadcast", + " │ └─TableFullScan 2.00 mpp[tiflash] table:d1_t keep order:false", + " └─TableFullScan(Probe) 8.00 mpp[tiflash] table:fact_t keep order:false" ] }, { "SQL": "explain format = 'brief' select count(*) from fact_t where not exists (select 1 from d1_t where d1_k = fact_t.d1_k and value > fact_t.col1)", "Plan": [ - "StreamAgg 1.00 root funcs:count(1)->Column#12", - "└─TableReader 6.40 root data:ExchangeSender", - " └─ExchangeSender 6.40 mpp[tiflash] ExchangeType: PassThrough", - " └─HashJoin 6.40 mpp[tiflash] anti semi join, equal:[eq(test.fact_t.d1_k, test.d1_t.d1_k)], other cond:gt(test.d1_t.value, test.fact_t.col1)", - " ├─ExchangeReceiver(Build) 2.00 mpp[tiflash] ", - " │ └─ExchangeSender 2.00 mpp[tiflash] ExchangeType: Broadcast", - " │ └─TableFullScan 2.00 mpp[tiflash] table:d1_t keep order:false", - " └─TableFullScan(Probe) 8.00 mpp[tiflash] table:fact_t keep order:false" + "HashAgg 1.00 root funcs:count(Column#13)->Column#12", + "└─TableReader 1.00 root data:ExchangeSender", + " └─ExchangeSender 1.00 mpp[tiflash] ExchangeType: PassThrough", + " └─HashAgg 1.00 mpp[tiflash] funcs:count(1)->Column#13", + " └─HashJoin 6.40 mpp[tiflash] anti semi join, equal:[eq(test.fact_t.d1_k, test.d1_t.d1_k)], other cond:gt(test.d1_t.value, test.fact_t.col1)", + " ├─ExchangeReceiver(Build) 2.00 mpp[tiflash] ", + " │ └─ExchangeSender 2.00 mpp[tiflash] ExchangeType: Broadcast", + " │ └─TableFullScan 2.00 mpp[tiflash] table:d1_t keep order:false", + " └─TableFullScan(Probe) 8.00 mpp[tiflash] table:fact_t keep order:false" ] }, { "SQL": "explain format = 'brief' select count(*) from fact_t join d1_t on fact_t.d1_k > d1_t.d1_k", "Plan": [ - "StreamAgg 1.00 root funcs:count(1)->Column#11", - "└─TableReader 16.00 root data:ExchangeSender", - " └─ExchangeSender 16.00 mpp[tiflash] ExchangeType: PassThrough", - " └─HashJoin 16.00 mpp[tiflash] CARTESIAN inner join, other cond:gt(test.fact_t.d1_k, test.d1_t.d1_k)", - " ├─ExchangeReceiver(Build) 2.00 mpp[tiflash] ", - " │ └─ExchangeSender 2.00 mpp[tiflash] ExchangeType: Broadcast", - " │ └─Selection 2.00 mpp[tiflash] not(isnull(test.d1_t.d1_k))", - " │ └─TableFullScan 2.00 mpp[tiflash] table:d1_t keep order:false", - " └─Selection(Probe) 8.00 mpp[tiflash] not(isnull(test.fact_t.d1_k))", - " └─TableFullScan 8.00 mpp[tiflash] table:fact_t keep order:false" + "HashAgg 1.00 root funcs:count(Column#12)->Column#11", + "└─TableReader 1.00 root data:ExchangeSender", + " └─ExchangeSender 1.00 mpp[tiflash] ExchangeType: PassThrough", + " └─HashAgg 1.00 mpp[tiflash] funcs:count(1)->Column#12", + " └─HashJoin 16.00 mpp[tiflash] CARTESIAN inner join, other cond:gt(test.fact_t.d1_k, test.d1_t.d1_k)", + " ├─ExchangeReceiver(Build) 2.00 mpp[tiflash] ", + " │ └─ExchangeSender 2.00 mpp[tiflash] ExchangeType: Broadcast", + " │ └─Selection 2.00 mpp[tiflash] not(isnull(test.d1_t.d1_k))", + " │ └─TableFullScan 2.00 mpp[tiflash] table:d1_t keep order:false", + " └─Selection(Probe) 8.00 mpp[tiflash] not(isnull(test.fact_t.d1_k))", + " └─TableFullScan 8.00 mpp[tiflash] table:fact_t keep order:false" ] }, { "SQL": "explain format = 'brief' select count(*) from fact_t left join d1_t on fact_t.d1_k > d1_t.d1_k", "Plan": [ - "StreamAgg 1.00 root funcs:count(1)->Column#11", - "└─TableReader 16.00 root data:ExchangeSender", - " └─ExchangeSender 16.00 mpp[tiflash] ExchangeType: PassThrough", - " └─HashJoin 16.00 mpp[tiflash] CARTESIAN left outer join, other cond:gt(test.fact_t.d1_k, test.d1_t.d1_k)", - " ├─ExchangeReceiver(Build) 2.00 mpp[tiflash] ", - " │ └─ExchangeSender 2.00 mpp[tiflash] ExchangeType: Broadcast", - " │ └─Selection 2.00 mpp[tiflash] not(isnull(test.d1_t.d1_k))", - " │ └─TableFullScan 2.00 mpp[tiflash] table:d1_t keep order:false", - " └─TableFullScan(Probe) 8.00 mpp[tiflash] table:fact_t keep order:false" + "HashAgg 1.00 root funcs:count(Column#12)->Column#11", + "└─TableReader 1.00 root data:ExchangeSender", + " └─ExchangeSender 1.00 mpp[tiflash] ExchangeType: PassThrough", + " └─HashAgg 1.00 mpp[tiflash] funcs:count(1)->Column#12", + " └─HashJoin 16.00 mpp[tiflash] CARTESIAN left outer join, other cond:gt(test.fact_t.d1_k, test.d1_t.d1_k)", + " ├─ExchangeReceiver(Build) 2.00 mpp[tiflash] ", + " │ └─ExchangeSender 2.00 mpp[tiflash] ExchangeType: Broadcast", + " │ └─Selection 2.00 mpp[tiflash] not(isnull(test.d1_t.d1_k))", + " │ └─TableFullScan 2.00 mpp[tiflash] table:d1_t keep order:false", + " └─TableFullScan(Probe) 8.00 mpp[tiflash] table:fact_t keep order:false" ] }, { "SQL": "explain format = 'brief' select count(*) from fact_t right join d1_t on fact_t.d1_k > d1_t.d1_k", "Plan": [ - "StreamAgg 1.00 root funcs:count(1)->Column#11", - "└─TableReader 16.00 root data:ExchangeSender", - " └─ExchangeSender 16.00 mpp[tiflash] ExchangeType: PassThrough", - " └─HashJoin 16.00 mpp[tiflash] CARTESIAN right outer join, other cond:gt(test.fact_t.d1_k, test.d1_t.d1_k)", - " ├─ExchangeReceiver(Build) 8.00 mpp[tiflash] ", - " │ └─ExchangeSender 8.00 mpp[tiflash] ExchangeType: Broadcast", - " │ └─Selection 8.00 mpp[tiflash] not(isnull(test.fact_t.d1_k))", - " │ └─TableFullScan 8.00 mpp[tiflash] table:fact_t keep order:false", - " └─TableFullScan(Probe) 2.00 mpp[tiflash] table:d1_t keep order:false" + "HashAgg 1.00 root funcs:count(Column#12)->Column#11", + "└─TableReader 1.00 root data:ExchangeSender", + " └─ExchangeSender 1.00 mpp[tiflash] ExchangeType: PassThrough", + " └─HashAgg 1.00 mpp[tiflash] funcs:count(1)->Column#12", + " └─HashJoin 16.00 mpp[tiflash] CARTESIAN right outer join, other cond:gt(test.fact_t.d1_k, test.d1_t.d1_k)", + " ├─ExchangeReceiver(Build) 8.00 mpp[tiflash] ", + " │ └─ExchangeSender 8.00 mpp[tiflash] ExchangeType: Broadcast", + " │ └─Selection 8.00 mpp[tiflash] not(isnull(test.fact_t.d1_k))", + " │ └─TableFullScan 8.00 mpp[tiflash] table:fact_t keep order:false", + " └─TableFullScan(Probe) 2.00 mpp[tiflash] table:d1_t keep order:false" ] }, { "SQL": "explain format = 'brief' select count(*) from fact_t where d1_k not in (select d1_k from d1_t)", "Plan": [ - "StreamAgg 1.00 root funcs:count(1)->Column#11", - "└─TableReader 6.40 root data:ExchangeSender", - " └─ExchangeSender 6.40 mpp[tiflash] ExchangeType: PassThrough", - " └─HashJoin 6.40 mpp[tiflash] CARTESIAN anti semi join, other cond:eq(test.fact_t.d1_k, test.d1_t.d1_k)", - " ├─ExchangeReceiver(Build) 2.00 mpp[tiflash] ", - " │ └─ExchangeSender 2.00 mpp[tiflash] ExchangeType: Broadcast", - " │ └─TableFullScan 2.00 mpp[tiflash] table:d1_t keep order:false", - " └─TableFullScan(Probe) 8.00 mpp[tiflash] table:fact_t keep order:false" + "HashAgg 1.00 root funcs:count(Column#12)->Column#11", + "└─TableReader 1.00 root data:ExchangeSender", + " └─ExchangeSender 1.00 mpp[tiflash] ExchangeType: PassThrough", + " └─HashAgg 1.00 mpp[tiflash] funcs:count(1)->Column#12", + " └─HashJoin 6.40 mpp[tiflash] CARTESIAN anti semi join, other cond:eq(test.fact_t.d1_k, test.d1_t.d1_k)", + " ├─ExchangeReceiver(Build) 2.00 mpp[tiflash] ", + " │ └─ExchangeSender 2.00 mpp[tiflash] ExchangeType: Broadcast", + " │ └─TableFullScan 2.00 mpp[tiflash] table:d1_t keep order:false", + " └─TableFullScan(Probe) 8.00 mpp[tiflash] table:fact_t keep order:false" ] } ] @@ -3601,294 +3624,310 @@ { "SQL": "explain format = 'brief' select count(*) from fact_t, d1_t where fact_t.d1_k = d1_t.d1_k", "Plan": [ - "StreamAgg 1.00 root funcs:count(1)->Column#11", - "└─TableReader 32.00 root data:ExchangeSender", - " └─ExchangeSender 32.00 mpp[tiflash] ExchangeType: PassThrough", - " └─HashJoin 32.00 mpp[tiflash] inner join, equal:[eq(test.d1_t.d1_k, test.fact_t.d1_k)]", - " ├─ExchangeReceiver(Build) 4.00 mpp[tiflash] ", - " │ └─ExchangeSender 4.00 mpp[tiflash] ExchangeType: HashPartition, Hash Cols: [name: test.d1_t.d1_k, collate: binary]", - " │ └─Selection 4.00 mpp[tiflash] not(isnull(test.d1_t.d1_k))", - " │ └─TableFullScan 4.00 mpp[tiflash] table:d1_t keep order:false", - " └─ExchangeReceiver(Probe) 16.00 mpp[tiflash] ", - " └─ExchangeSender 16.00 mpp[tiflash] ExchangeType: HashPartition, Hash Cols: [name: test.fact_t.d1_k, collate: binary]", - " └─Selection 16.00 mpp[tiflash] not(isnull(test.fact_t.d1_k))", - " └─TableFullScan 16.00 mpp[tiflash] table:fact_t keep order:false" + "HashAgg 1.00 root funcs:count(Column#12)->Column#11", + "└─TableReader 1.00 root data:ExchangeSender", + " └─ExchangeSender 1.00 mpp[tiflash] ExchangeType: PassThrough", + " └─HashAgg 1.00 mpp[tiflash] funcs:count(1)->Column#12", + " └─HashJoin 32.00 mpp[tiflash] inner join, equal:[eq(test.d1_t.d1_k, test.fact_t.d1_k)]", + " ├─ExchangeReceiver(Build) 4.00 mpp[tiflash] ", + " │ └─ExchangeSender 4.00 mpp[tiflash] ExchangeType: HashPartition, Hash Cols: [name: test.d1_t.d1_k, collate: binary]", + " │ └─Selection 4.00 mpp[tiflash] not(isnull(test.d1_t.d1_k))", + " │ └─TableFullScan 4.00 mpp[tiflash] table:d1_t keep order:false", + " └─ExchangeReceiver(Probe) 16.00 mpp[tiflash] ", + " └─ExchangeSender 16.00 mpp[tiflash] ExchangeType: HashPartition, Hash Cols: [name: test.fact_t.d1_k, collate: binary]", + " └─Selection 16.00 mpp[tiflash] not(isnull(test.fact_t.d1_k))", + " └─TableFullScan 16.00 mpp[tiflash] table:fact_t keep order:false" ] }, { "SQL": "explain format = 'brief' select count(*) from fact_t, d1_t, d2_t, d3_t where fact_t.d1_k = d1_t.d1_k and fact_t.d2_k = d2_t.d2_k and fact_t.d3_k = d3_t.d3_k", "Plan": [ - "StreamAgg 1.00 root funcs:count(1)->Column#17", - "└─TableReader 128.00 root data:ExchangeSender", - " └─ExchangeSender 128.00 mpp[tiflash] ExchangeType: PassThrough", - " └─HashJoin 128.00 mpp[tiflash] inner join, equal:[eq(test.fact_t.d3_k, test.d3_t.d3_k)]", - " ├─ExchangeReceiver(Build) 4.00 mpp[tiflash] ", - " │ └─ExchangeSender 4.00 mpp[tiflash] ExchangeType: HashPartition, Hash Cols: [name: test.d3_t.d3_k, collate: binary]", - " │ └─Selection 4.00 mpp[tiflash] not(isnull(test.d3_t.d3_k))", - " │ └─TableFullScan 4.00 mpp[tiflash] table:d3_t keep order:false", - " └─ExchangeReceiver(Probe) 64.00 mpp[tiflash] ", - " └─ExchangeSender 64.00 mpp[tiflash] ExchangeType: HashPartition, Hash Cols: [name: test.fact_t.d3_k, collate: binary]", - " └─HashJoin 64.00 mpp[tiflash] inner join, equal:[eq(test.fact_t.d2_k, test.d2_t.d2_k)]", - " ├─ExchangeReceiver(Build) 4.00 mpp[tiflash] ", - " │ └─ExchangeSender 4.00 mpp[tiflash] ExchangeType: HashPartition, Hash Cols: [name: test.d2_t.d2_k, collate: binary]", - " │ └─Selection 4.00 mpp[tiflash] not(isnull(test.d2_t.d2_k))", - " │ └─TableFullScan 4.00 mpp[tiflash] table:d2_t keep order:false", - " └─ExchangeReceiver(Probe) 32.00 mpp[tiflash] ", - " └─ExchangeSender 32.00 mpp[tiflash] ExchangeType: HashPartition, Hash Cols: [name: test.fact_t.d2_k, collate: binary]", - " └─HashJoin 32.00 mpp[tiflash] inner join, equal:[eq(test.d1_t.d1_k, test.fact_t.d1_k)]", - " ├─ExchangeReceiver(Build) 4.00 mpp[tiflash] ", - " │ └─ExchangeSender 4.00 mpp[tiflash] ExchangeType: HashPartition, Hash Cols: [name: test.d1_t.d1_k, collate: binary]", - " │ └─Selection 4.00 mpp[tiflash] not(isnull(test.d1_t.d1_k))", - " │ └─TableFullScan 4.00 mpp[tiflash] table:d1_t keep order:false", - " └─ExchangeReceiver(Probe) 16.00 mpp[tiflash] ", - " └─ExchangeSender 16.00 mpp[tiflash] ExchangeType: HashPartition, Hash Cols: [name: test.fact_t.d1_k, collate: binary]", - " └─Selection 16.00 mpp[tiflash] not(isnull(test.fact_t.d1_k)), not(isnull(test.fact_t.d2_k)), not(isnull(test.fact_t.d3_k))", - " └─TableFullScan 16.00 mpp[tiflash] table:fact_t keep order:false" + "HashAgg 1.00 root funcs:count(Column#18)->Column#17", + "└─TableReader 1.00 root data:ExchangeSender", + " └─ExchangeSender 1.00 mpp[tiflash] ExchangeType: PassThrough", + " └─HashAgg 1.00 mpp[tiflash] funcs:count(1)->Column#18", + " └─HashJoin 128.00 mpp[tiflash] inner join, equal:[eq(test.fact_t.d3_k, test.d3_t.d3_k)]", + " ├─ExchangeReceiver(Build) 4.00 mpp[tiflash] ", + " │ └─ExchangeSender 4.00 mpp[tiflash] ExchangeType: HashPartition, Hash Cols: [name: test.d3_t.d3_k, collate: binary]", + " │ └─Selection 4.00 mpp[tiflash] not(isnull(test.d3_t.d3_k))", + " │ └─TableFullScan 4.00 mpp[tiflash] table:d3_t keep order:false", + " └─ExchangeReceiver(Probe) 64.00 mpp[tiflash] ", + " └─ExchangeSender 64.00 mpp[tiflash] ExchangeType: HashPartition, Hash Cols: [name: test.fact_t.d3_k, collate: binary]", + " └─HashJoin 64.00 mpp[tiflash] inner join, equal:[eq(test.fact_t.d2_k, test.d2_t.d2_k)]", + " ├─ExchangeReceiver(Build) 4.00 mpp[tiflash] ", + " │ └─ExchangeSender 4.00 mpp[tiflash] ExchangeType: HashPartition, Hash Cols: [name: test.d2_t.d2_k, collate: binary]", + " │ └─Selection 4.00 mpp[tiflash] not(isnull(test.d2_t.d2_k))", + " │ └─TableFullScan 4.00 mpp[tiflash] table:d2_t keep order:false", + " └─ExchangeReceiver(Probe) 32.00 mpp[tiflash] ", + " └─ExchangeSender 32.00 mpp[tiflash] ExchangeType: HashPartition, Hash Cols: [name: test.fact_t.d2_k, collate: binary]", + " └─HashJoin 32.00 mpp[tiflash] inner join, equal:[eq(test.d1_t.d1_k, test.fact_t.d1_k)]", + " ├─ExchangeReceiver(Build) 4.00 mpp[tiflash] ", + " │ └─ExchangeSender 4.00 mpp[tiflash] ExchangeType: HashPartition, Hash Cols: [name: test.d1_t.d1_k, collate: binary]", + " │ └─Selection 4.00 mpp[tiflash] not(isnull(test.d1_t.d1_k))", + " │ └─TableFullScan 4.00 mpp[tiflash] table:d1_t keep order:false", + " └─ExchangeReceiver(Probe) 16.00 mpp[tiflash] ", + " └─ExchangeSender 16.00 mpp[tiflash] ExchangeType: HashPartition, Hash Cols: [name: test.fact_t.d1_k, collate: binary]", + " └─Selection 16.00 mpp[tiflash] not(isnull(test.fact_t.d1_k)), not(isnull(test.fact_t.d2_k)), not(isnull(test.fact_t.d3_k))", + " └─TableFullScan 16.00 mpp[tiflash] table:fact_t keep order:false" ] }, { "SQL": "explain format = 'brief' select count(*) from fact_t, d1_t where fact_t.d1_k = d1_t.d1_k", "Plan": [ - "StreamAgg 1.00 root funcs:count(1)->Column#11", - "└─TableReader 32.00 root data:ExchangeSender", - " └─ExchangeSender 32.00 mpp[tiflash] ExchangeType: PassThrough", - " └─HashJoin 32.00 mpp[tiflash] inner join, equal:[eq(test.d1_t.d1_k, test.fact_t.d1_k)]", - " ├─ExchangeReceiver(Build) 4.00 mpp[tiflash] ", - " │ └─ExchangeSender 4.00 mpp[tiflash] ExchangeType: HashPartition, Hash Cols: [name: test.d1_t.d1_k, collate: binary]", - " │ └─Selection 4.00 mpp[tiflash] not(isnull(test.d1_t.d1_k))", - " │ └─TableFullScan 4.00 mpp[tiflash] table:d1_t keep order:false", - " └─ExchangeReceiver(Probe) 16.00 mpp[tiflash] ", - " └─ExchangeSender 16.00 mpp[tiflash] ExchangeType: HashPartition, Hash Cols: [name: test.fact_t.d1_k, collate: binary]", - " └─Selection 16.00 mpp[tiflash] not(isnull(test.fact_t.d1_k))", - " └─TableFullScan 16.00 mpp[tiflash] table:fact_t keep order:false" + "HashAgg 1.00 root funcs:count(Column#12)->Column#11", + "└─TableReader 1.00 root data:ExchangeSender", + " └─ExchangeSender 1.00 mpp[tiflash] ExchangeType: PassThrough", + " └─HashAgg 1.00 mpp[tiflash] funcs:count(1)->Column#12", + " └─HashJoin 32.00 mpp[tiflash] inner join, equal:[eq(test.d1_t.d1_k, test.fact_t.d1_k)]", + " ├─ExchangeReceiver(Build) 4.00 mpp[tiflash] ", + " │ └─ExchangeSender 4.00 mpp[tiflash] ExchangeType: HashPartition, Hash Cols: [name: test.d1_t.d1_k, collate: binary]", + " │ └─Selection 4.00 mpp[tiflash] not(isnull(test.d1_t.d1_k))", + " │ └─TableFullScan 4.00 mpp[tiflash] table:d1_t keep order:false", + " └─ExchangeReceiver(Probe) 16.00 mpp[tiflash] ", + " └─ExchangeSender 16.00 mpp[tiflash] ExchangeType: HashPartition, Hash Cols: [name: test.fact_t.d1_k, collate: binary]", + " └─Selection 16.00 mpp[tiflash] not(isnull(test.fact_t.d1_k))", + " └─TableFullScan 16.00 mpp[tiflash] table:fact_t keep order:false" ] }, { "SQL": "explain format = 'brief' select count(*) from fact_t, d1_t, d2_t, d3_t where fact_t.d1_k = d1_t.d1_k and fact_t.d1_k = d2_t.value and fact_t.d1_k = d3_t.value", "Plan": [ - "StreamAgg 1.00 root funcs:count(1)->Column#17", - "└─TableReader 128.00 root data:ExchangeSender", - " └─ExchangeSender 128.00 mpp[tiflash] ExchangeType: PassThrough", - " └─HashJoin 128.00 mpp[tiflash] inner join, equal:[eq(test.fact_t.d1_k, test.d3_t.value)]", - " ├─ExchangeReceiver(Build) 4.00 mpp[tiflash] ", - " │ └─ExchangeSender 4.00 mpp[tiflash] ExchangeType: HashPartition, Hash Cols: [name: test.d3_t.value, collate: binary]", - " │ └─Selection 4.00 mpp[tiflash] not(isnull(test.d3_t.value))", - " │ └─TableFullScan 4.00 mpp[tiflash] table:d3_t keep order:false", - " └─HashJoin(Probe) 64.00 mpp[tiflash] inner join, equal:[eq(test.fact_t.d1_k, test.d2_t.value)]", + "HashAgg 1.00 root funcs:count(Column#18)->Column#17", + "└─TableReader 1.00 root data:ExchangeSender", + " └─ExchangeSender 1.00 mpp[tiflash] ExchangeType: PassThrough", + " └─HashAgg 1.00 mpp[tiflash] funcs:count(1)->Column#18", + " └─HashJoin 128.00 mpp[tiflash] inner join, equal:[eq(test.fact_t.d1_k, test.d3_t.value)]", " ├─ExchangeReceiver(Build) 4.00 mpp[tiflash] ", - " │ └─ExchangeSender 4.00 mpp[tiflash] ExchangeType: HashPartition, Hash Cols: [name: test.d2_t.value, collate: binary]", - " │ └─Selection 4.00 mpp[tiflash] not(isnull(test.d2_t.value))", - " │ └─TableFullScan 4.00 mpp[tiflash] table:d2_t keep order:false", - " └─HashJoin(Probe) 32.00 mpp[tiflash] inner join, equal:[eq(test.d1_t.d1_k, test.fact_t.d1_k)]", + " │ └─ExchangeSender 4.00 mpp[tiflash] ExchangeType: HashPartition, Hash Cols: [name: test.d3_t.value, collate: binary]", + " │ └─Selection 4.00 mpp[tiflash] not(isnull(test.d3_t.value))", + " │ └─TableFullScan 4.00 mpp[tiflash] table:d3_t keep order:false", + " └─HashJoin(Probe) 64.00 mpp[tiflash] inner join, equal:[eq(test.fact_t.d1_k, test.d2_t.value)]", " ├─ExchangeReceiver(Build) 4.00 mpp[tiflash] ", - " │ └─ExchangeSender 4.00 mpp[tiflash] ExchangeType: HashPartition, Hash Cols: [name: test.d1_t.d1_k, collate: binary]", - " │ └─Selection 4.00 mpp[tiflash] not(isnull(test.d1_t.d1_k))", - " │ └─TableFullScan 4.00 mpp[tiflash] table:d1_t keep order:false", - " └─ExchangeReceiver(Probe) 16.00 mpp[tiflash] ", - " └─ExchangeSender 16.00 mpp[tiflash] ExchangeType: HashPartition, Hash Cols: [name: test.fact_t.d1_k, collate: binary]", - " └─Selection 16.00 mpp[tiflash] not(isnull(test.fact_t.d1_k))", - " └─TableFullScan 16.00 mpp[tiflash] table:fact_t keep order:false" + " │ └─ExchangeSender 4.00 mpp[tiflash] ExchangeType: HashPartition, Hash Cols: [name: test.d2_t.value, collate: binary]", + " │ └─Selection 4.00 mpp[tiflash] not(isnull(test.d2_t.value))", + " │ └─TableFullScan 4.00 mpp[tiflash] table:d2_t keep order:false", + " └─HashJoin(Probe) 32.00 mpp[tiflash] inner join, equal:[eq(test.d1_t.d1_k, test.fact_t.d1_k)]", + " ├─ExchangeReceiver(Build) 4.00 mpp[tiflash] ", + " │ └─ExchangeSender 4.00 mpp[tiflash] ExchangeType: HashPartition, Hash Cols: [name: test.d1_t.d1_k, collate: binary]", + " │ └─Selection 4.00 mpp[tiflash] not(isnull(test.d1_t.d1_k))", + " │ └─TableFullScan 4.00 mpp[tiflash] table:d1_t keep order:false", + " └─ExchangeReceiver(Probe) 16.00 mpp[tiflash] ", + " └─ExchangeSender 16.00 mpp[tiflash] ExchangeType: HashPartition, Hash Cols: [name: test.fact_t.d1_k, collate: binary]", + " └─Selection 16.00 mpp[tiflash] not(isnull(test.fact_t.d1_k))", + " └─TableFullScan 16.00 mpp[tiflash] table:fact_t keep order:false" ] }, { "SQL": "explain format = 'brief' select count(*) from fact_t left join d1_t on fact_t.d1_k = d1_t.d1_k", "Plan": [ - "StreamAgg 1.00 root funcs:count(1)->Column#11", - "└─TableReader 32.00 root data:ExchangeSender", - " └─ExchangeSender 32.00 mpp[tiflash] ExchangeType: PassThrough", - " └─HashJoin 32.00 mpp[tiflash] left outer join, equal:[eq(test.fact_t.d1_k, test.d1_t.d1_k)]", - " ├─ExchangeReceiver(Build) 4.00 mpp[tiflash] ", - " │ └─ExchangeSender 4.00 mpp[tiflash] ExchangeType: HashPartition, Hash Cols: [name: test.d1_t.d1_k, collate: binary]", - " │ └─Selection 4.00 mpp[tiflash] not(isnull(test.d1_t.d1_k))", - " │ └─TableFullScan 4.00 mpp[tiflash] table:d1_t keep order:false", - " └─ExchangeReceiver(Probe) 16.00 mpp[tiflash] ", - " └─ExchangeSender 16.00 mpp[tiflash] ExchangeType: HashPartition, Hash Cols: [name: test.fact_t.d1_k, collate: binary]", - " └─TableFullScan 16.00 mpp[tiflash] table:fact_t keep order:false" + "HashAgg 1.00 root funcs:count(Column#12)->Column#11", + "└─TableReader 1.00 root data:ExchangeSender", + " └─ExchangeSender 1.00 mpp[tiflash] ExchangeType: PassThrough", + " └─HashAgg 1.00 mpp[tiflash] funcs:count(1)->Column#12", + " └─HashJoin 32.00 mpp[tiflash] left outer join, equal:[eq(test.fact_t.d1_k, test.d1_t.d1_k)]", + " ├─ExchangeReceiver(Build) 4.00 mpp[tiflash] ", + " │ └─ExchangeSender 4.00 mpp[tiflash] ExchangeType: HashPartition, Hash Cols: [name: test.d1_t.d1_k, collate: binary]", + " │ └─Selection 4.00 mpp[tiflash] not(isnull(test.d1_t.d1_k))", + " │ └─TableFullScan 4.00 mpp[tiflash] table:d1_t keep order:false", + " └─ExchangeReceiver(Probe) 16.00 mpp[tiflash] ", + " └─ExchangeSender 16.00 mpp[tiflash] ExchangeType: HashPartition, Hash Cols: [name: test.fact_t.d1_k, collate: binary]", + " └─TableFullScan 16.00 mpp[tiflash] table:fact_t keep order:false" ] }, { "SQL": "explain format = 'brief' select count(*) from fact_t right join d1_t on fact_t.d1_k = d1_t.d1_k", "Plan": [ - "StreamAgg 1.00 root funcs:count(1)->Column#11", - "└─TableReader 32.00 root data:ExchangeSender", - " └─ExchangeSender 32.00 mpp[tiflash] ExchangeType: PassThrough", - " └─HashJoin 32.00 mpp[tiflash] right outer join, equal:[eq(test.fact_t.d1_k, test.d1_t.d1_k)]", - " ├─ExchangeReceiver(Build) 4.00 mpp[tiflash] ", - " │ └─ExchangeSender 4.00 mpp[tiflash] ExchangeType: HashPartition, Hash Cols: [name: test.d1_t.d1_k, collate: binary]", - " │ └─TableFullScan 4.00 mpp[tiflash] table:d1_t keep order:false", - " └─ExchangeReceiver(Probe) 16.00 mpp[tiflash] ", - " └─ExchangeSender 16.00 mpp[tiflash] ExchangeType: HashPartition, Hash Cols: [name: test.fact_t.d1_k, collate: binary]", - " └─Selection 16.00 mpp[tiflash] not(isnull(test.fact_t.d1_k))", - " └─TableFullScan 16.00 mpp[tiflash] table:fact_t keep order:false" + "HashAgg 1.00 root funcs:count(Column#12)->Column#11", + "└─TableReader 1.00 root data:ExchangeSender", + " └─ExchangeSender 1.00 mpp[tiflash] ExchangeType: PassThrough", + " └─HashAgg 1.00 mpp[tiflash] funcs:count(1)->Column#12", + " └─HashJoin 32.00 mpp[tiflash] right outer join, equal:[eq(test.fact_t.d1_k, test.d1_t.d1_k)]", + " ├─ExchangeReceiver(Build) 4.00 mpp[tiflash] ", + " │ └─ExchangeSender 4.00 mpp[tiflash] ExchangeType: HashPartition, Hash Cols: [name: test.d1_t.d1_k, collate: binary]", + " │ └─TableFullScan 4.00 mpp[tiflash] table:d1_t keep order:false", + " └─ExchangeReceiver(Probe) 16.00 mpp[tiflash] ", + " └─ExchangeSender 16.00 mpp[tiflash] ExchangeType: HashPartition, Hash Cols: [name: test.fact_t.d1_k, collate: binary]", + " └─Selection 16.00 mpp[tiflash] not(isnull(test.fact_t.d1_k))", + " └─TableFullScan 16.00 mpp[tiflash] table:fact_t keep order:false" ] }, { "SQL": "explain format = 'brief' select count(*) from fact_t join d1_t on fact_t.d1_k = d1_t.d1_k and fact_t.col1 > d1_t.value", "Plan": [ - "StreamAgg 1.00 root funcs:count(1)->Column#11", - "└─TableReader 32.00 root data:ExchangeSender", - " └─ExchangeSender 32.00 mpp[tiflash] ExchangeType: PassThrough", - " └─HashJoin 32.00 mpp[tiflash] inner join, equal:[eq(test.d1_t.d1_k, test.fact_t.d1_k)], other cond:gt(test.fact_t.col1, test.d1_t.value)", - " ├─ExchangeReceiver(Build) 4.00 mpp[tiflash] ", - " │ └─ExchangeSender 4.00 mpp[tiflash] ExchangeType: HashPartition, Hash Cols: [name: test.d1_t.d1_k, collate: binary]", - " │ └─Selection 4.00 mpp[tiflash] not(isnull(test.d1_t.d1_k)), not(isnull(test.d1_t.value))", - " │ └─TableFullScan 4.00 mpp[tiflash] table:d1_t keep order:false", - " └─ExchangeReceiver(Probe) 16.00 mpp[tiflash] ", - " └─ExchangeSender 16.00 mpp[tiflash] ExchangeType: HashPartition, Hash Cols: [name: test.fact_t.d1_k, collate: binary]", - " └─Selection 16.00 mpp[tiflash] not(isnull(test.fact_t.col1)), not(isnull(test.fact_t.d1_k))", - " └─TableFullScan 16.00 mpp[tiflash] table:fact_t keep order:false" + "HashAgg 1.00 root funcs:count(Column#12)->Column#11", + "└─TableReader 1.00 root data:ExchangeSender", + " └─ExchangeSender 1.00 mpp[tiflash] ExchangeType: PassThrough", + " └─HashAgg 1.00 mpp[tiflash] funcs:count(1)->Column#12", + " └─HashJoin 32.00 mpp[tiflash] inner join, equal:[eq(test.d1_t.d1_k, test.fact_t.d1_k)], other cond:gt(test.fact_t.col1, test.d1_t.value)", + " ├─ExchangeReceiver(Build) 4.00 mpp[tiflash] ", + " │ └─ExchangeSender 4.00 mpp[tiflash] ExchangeType: HashPartition, Hash Cols: [name: test.d1_t.d1_k, collate: binary]", + " │ └─Selection 4.00 mpp[tiflash] not(isnull(test.d1_t.d1_k)), not(isnull(test.d1_t.value))", + " │ └─TableFullScan 4.00 mpp[tiflash] table:d1_t keep order:false", + " └─ExchangeReceiver(Probe) 16.00 mpp[tiflash] ", + " └─ExchangeSender 16.00 mpp[tiflash] ExchangeType: HashPartition, Hash Cols: [name: test.fact_t.d1_k, collate: binary]", + " └─Selection 16.00 mpp[tiflash] not(isnull(test.fact_t.col1)), not(isnull(test.fact_t.d1_k))", + " └─TableFullScan 16.00 mpp[tiflash] table:fact_t keep order:false" ] }, { "SQL": "explain format = 'brief' select count(*) from fact_t left join d1_t on fact_t.d1_k = d1_t.d1_k and fact_t.col1 > 10", "Plan": [ - "StreamAgg 1.00 root funcs:count(1)->Column#11", - "└─TableReader 32.00 root data:ExchangeSender", - " └─ExchangeSender 32.00 mpp[tiflash] ExchangeType: PassThrough", - " └─HashJoin 32.00 mpp[tiflash] left outer join, equal:[eq(test.fact_t.d1_k, test.d1_t.d1_k)], left cond:[gt(test.fact_t.col1, 10)]", - " ├─ExchangeReceiver(Build) 4.00 mpp[tiflash] ", - " │ └─ExchangeSender 4.00 mpp[tiflash] ExchangeType: HashPartition, Hash Cols: [name: test.d1_t.d1_k, collate: binary]", - " │ └─Selection 4.00 mpp[tiflash] not(isnull(test.d1_t.d1_k))", - " │ └─TableFullScan 4.00 mpp[tiflash] table:d1_t keep order:false", - " └─ExchangeReceiver(Probe) 16.00 mpp[tiflash] ", - " └─ExchangeSender 16.00 mpp[tiflash] ExchangeType: HashPartition, Hash Cols: [name: test.fact_t.d1_k, collate: binary]", - " └─TableFullScan 16.00 mpp[tiflash] table:fact_t keep order:false" + "HashAgg 1.00 root funcs:count(Column#12)->Column#11", + "└─TableReader 1.00 root data:ExchangeSender", + " └─ExchangeSender 1.00 mpp[tiflash] ExchangeType: PassThrough", + " └─HashAgg 1.00 mpp[tiflash] funcs:count(1)->Column#12", + " └─HashJoin 32.00 mpp[tiflash] left outer join, equal:[eq(test.fact_t.d1_k, test.d1_t.d1_k)], left cond:[gt(test.fact_t.col1, 10)]", + " ├─ExchangeReceiver(Build) 4.00 mpp[tiflash] ", + " │ └─ExchangeSender 4.00 mpp[tiflash] ExchangeType: HashPartition, Hash Cols: [name: test.d1_t.d1_k, collate: binary]", + " │ └─Selection 4.00 mpp[tiflash] not(isnull(test.d1_t.d1_k))", + " │ └─TableFullScan 4.00 mpp[tiflash] table:d1_t keep order:false", + " └─ExchangeReceiver(Probe) 16.00 mpp[tiflash] ", + " └─ExchangeSender 16.00 mpp[tiflash] ExchangeType: HashPartition, Hash Cols: [name: test.fact_t.d1_k, collate: binary]", + " └─TableFullScan 16.00 mpp[tiflash] table:fact_t keep order:false" ] }, { "SQL": "explain format = 'brief' select count(*) from (select case when t1.col1 is null then t2.col1 + 5 else 10 end as col1, t2.d1_k as d1_k from fact_t t1 right join fact_t t2 on t1.d1_k = t2.d1_k) fact_t join d1_t on fact_t.d1_k = d1_t.d1_k and fact_t.col1 > 5", "Plan": [ - "StreamAgg 1.00 root funcs:count(1)->Column#19", - "└─TableReader 204.80 root data:ExchangeSender", - " └─ExchangeSender 204.80 mpp[tiflash] ExchangeType: PassThrough", - " └─HashJoin 204.80 mpp[tiflash] inner join, equal:[eq(test.d1_t.d1_k, test.fact_t.d1_k)]", - " ├─ExchangeReceiver(Build) 4.00 mpp[tiflash] ", - " │ └─ExchangeSender 4.00 mpp[tiflash] ExchangeType: HashPartition, Hash Cols: [name: test.d1_t.d1_k, collate: binary]", - " │ └─Selection 4.00 mpp[tiflash] not(isnull(test.d1_t.d1_k))", - " │ └─TableFullScan 4.00 mpp[tiflash] table:d1_t keep order:false", - " └─Projection(Probe) 102.40 mpp[tiflash] test.fact_t.d1_k", - " └─Selection 102.40 mpp[tiflash] gt(case(isnull(test.fact_t.col1), plus(test.fact_t.col1, 5), 10), 5)", - " └─HashJoin 128.00 mpp[tiflash] right outer join, equal:[eq(test.fact_t.d1_k, test.fact_t.d1_k)]", - " ├─ExchangeReceiver(Build) 16.00 mpp[tiflash] ", - " │ └─ExchangeSender 16.00 mpp[tiflash] ExchangeType: HashPartition, Hash Cols: [name: test.fact_t.d1_k, collate: binary]", - " │ └─Selection 16.00 mpp[tiflash] not(isnull(test.fact_t.d1_k))", - " │ └─TableFullScan 16.00 mpp[tiflash] table:t1 keep order:false", - " └─ExchangeReceiver(Probe) 16.00 mpp[tiflash] ", - " └─ExchangeSender 16.00 mpp[tiflash] ExchangeType: HashPartition, Hash Cols: [name: test.fact_t.d1_k, collate: binary]", - " └─Selection 16.00 mpp[tiflash] not(isnull(test.fact_t.d1_k))", - " └─TableFullScan 16.00 mpp[tiflash] table:t2 keep order:false" + "HashAgg 1.00 root funcs:count(Column#22)->Column#19", + "└─TableReader 1.00 root data:ExchangeSender", + " └─ExchangeSender 1.00 mpp[tiflash] ExchangeType: PassThrough", + " └─HashAgg 1.00 mpp[tiflash] funcs:count(1)->Column#22", + " └─HashJoin 204.80 mpp[tiflash] inner join, equal:[eq(test.d1_t.d1_k, test.fact_t.d1_k)]", + " ├─ExchangeReceiver(Build) 4.00 mpp[tiflash] ", + " │ └─ExchangeSender 4.00 mpp[tiflash] ExchangeType: HashPartition, Hash Cols: [name: test.d1_t.d1_k, collate: binary]", + " │ └─Selection 4.00 mpp[tiflash] not(isnull(test.d1_t.d1_k))", + " │ └─TableFullScan 4.00 mpp[tiflash] table:d1_t keep order:false", + " └─Projection(Probe) 102.40 mpp[tiflash] test.fact_t.d1_k", + " └─Selection 102.40 mpp[tiflash] gt(case(isnull(test.fact_t.col1), plus(test.fact_t.col1, 5), 10), 5)", + " └─HashJoin 128.00 mpp[tiflash] right outer join, equal:[eq(test.fact_t.d1_k, test.fact_t.d1_k)]", + " ├─ExchangeReceiver(Build) 16.00 mpp[tiflash] ", + " │ └─ExchangeSender 16.00 mpp[tiflash] ExchangeType: HashPartition, Hash Cols: [name: test.fact_t.d1_k, collate: binary]", + " │ └─Selection 16.00 mpp[tiflash] not(isnull(test.fact_t.d1_k))", + " │ └─TableFullScan 16.00 mpp[tiflash] table:t1 keep order:false", + " └─ExchangeReceiver(Probe) 16.00 mpp[tiflash] ", + " └─ExchangeSender 16.00 mpp[tiflash] ExchangeType: HashPartition, Hash Cols: [name: test.fact_t.d1_k, collate: binary]", + " └─Selection 16.00 mpp[tiflash] not(isnull(test.fact_t.d1_k))", + " └─TableFullScan 16.00 mpp[tiflash] table:t2 keep order:false" ] }, { "SQL": "explain format = 'brief' select count(*) from fact_t left join d1_t on fact_t.d1_k = d1_t.d1_k and fact_t.col2 > 10 and fact_t.col1 > d1_t.value", "Plan": [ - "StreamAgg 1.00 root funcs:count(1)->Column#11", - "└─TableReader 32.00 root data:ExchangeSender", - " └─ExchangeSender 32.00 mpp[tiflash] ExchangeType: PassThrough", - " └─HashJoin 32.00 mpp[tiflash] left outer join, equal:[eq(test.fact_t.d1_k, test.d1_t.d1_k)], left cond:[gt(test.fact_t.col2, 10)], other cond:gt(test.fact_t.col1, test.d1_t.value)", - " ├─ExchangeReceiver(Build) 4.00 mpp[tiflash] ", - " │ └─ExchangeSender 4.00 mpp[tiflash] ExchangeType: HashPartition, Hash Cols: [name: test.d1_t.d1_k, collate: binary]", - " │ └─Selection 4.00 mpp[tiflash] not(isnull(test.d1_t.d1_k)), not(isnull(test.d1_t.value))", - " │ └─TableFullScan 4.00 mpp[tiflash] table:d1_t keep order:false", - " └─ExchangeReceiver(Probe) 16.00 mpp[tiflash] ", - " └─ExchangeSender 16.00 mpp[tiflash] ExchangeType: HashPartition, Hash Cols: [name: test.fact_t.d1_k, collate: binary]", - " └─TableFullScan 16.00 mpp[tiflash] table:fact_t keep order:false" + "HashAgg 1.00 root funcs:count(Column#12)->Column#11", + "└─TableReader 1.00 root data:ExchangeSender", + " └─ExchangeSender 1.00 mpp[tiflash] ExchangeType: PassThrough", + " └─HashAgg 1.00 mpp[tiflash] funcs:count(1)->Column#12", + " └─HashJoin 32.00 mpp[tiflash] left outer join, equal:[eq(test.fact_t.d1_k, test.d1_t.d1_k)], left cond:[gt(test.fact_t.col2, 10)], other cond:gt(test.fact_t.col1, test.d1_t.value)", + " ├─ExchangeReceiver(Build) 4.00 mpp[tiflash] ", + " │ └─ExchangeSender 4.00 mpp[tiflash] ExchangeType: HashPartition, Hash Cols: [name: test.d1_t.d1_k, collate: binary]", + " │ └─Selection 4.00 mpp[tiflash] not(isnull(test.d1_t.d1_k)), not(isnull(test.d1_t.value))", + " │ └─TableFullScan 4.00 mpp[tiflash] table:d1_t keep order:false", + " └─ExchangeReceiver(Probe) 16.00 mpp[tiflash] ", + " └─ExchangeSender 16.00 mpp[tiflash] ExchangeType: HashPartition, Hash Cols: [name: test.fact_t.d1_k, collate: binary]", + " └─TableFullScan 16.00 mpp[tiflash] table:fact_t keep order:false" ] }, { "SQL": "explain format = 'brief' select count(*) from fact_t right join d1_t on fact_t.d1_k = d1_t.d1_k and d1_t.value > 10", "Plan": [ - "StreamAgg 1.00 root funcs:count(1)->Column#11", - "└─TableReader 32.00 root data:ExchangeSender", - " └─ExchangeSender 32.00 mpp[tiflash] ExchangeType: PassThrough", - " └─HashJoin 32.00 mpp[tiflash] right outer join, equal:[eq(test.fact_t.d1_k, test.d1_t.d1_k)], right cond:gt(test.d1_t.value, 10)", - " ├─ExchangeReceiver(Build) 4.00 mpp[tiflash] ", - " │ └─ExchangeSender 4.00 mpp[tiflash] ExchangeType: HashPartition, Hash Cols: [name: test.d1_t.d1_k, collate: binary]", - " │ └─TableFullScan 4.00 mpp[tiflash] table:d1_t keep order:false", - " └─ExchangeReceiver(Probe) 16.00 mpp[tiflash] ", - " └─ExchangeSender 16.00 mpp[tiflash] ExchangeType: HashPartition, Hash Cols: [name: test.fact_t.d1_k, collate: binary]", - " └─Selection 16.00 mpp[tiflash] not(isnull(test.fact_t.d1_k))", - " └─TableFullScan 16.00 mpp[tiflash] table:fact_t keep order:false" + "HashAgg 1.00 root funcs:count(Column#12)->Column#11", + "└─TableReader 1.00 root data:ExchangeSender", + " └─ExchangeSender 1.00 mpp[tiflash] ExchangeType: PassThrough", + " └─HashAgg 1.00 mpp[tiflash] funcs:count(1)->Column#12", + " └─HashJoin 32.00 mpp[tiflash] right outer join, equal:[eq(test.fact_t.d1_k, test.d1_t.d1_k)], right cond:gt(test.d1_t.value, 10)", + " ├─ExchangeReceiver(Build) 4.00 mpp[tiflash] ", + " │ └─ExchangeSender 4.00 mpp[tiflash] ExchangeType: HashPartition, Hash Cols: [name: test.d1_t.d1_k, collate: binary]", + " │ └─TableFullScan 4.00 mpp[tiflash] table:d1_t keep order:false", + " └─ExchangeReceiver(Probe) 16.00 mpp[tiflash] ", + " └─ExchangeSender 16.00 mpp[tiflash] ExchangeType: HashPartition, Hash Cols: [name: test.fact_t.d1_k, collate: binary]", + " └─Selection 16.00 mpp[tiflash] not(isnull(test.fact_t.d1_k))", + " └─TableFullScan 16.00 mpp[tiflash] table:fact_t keep order:false" ] }, { "SQL": "explain format = 'brief' select count(*) from fact_t right join d1_t on fact_t.d1_k = d1_t.d1_k and d1_t.value > 10 and fact_t.col1 > d1_t.value", "Plan": [ - "StreamAgg 1.00 root funcs:count(1)->Column#11", - "└─TableReader 32.00 root data:ExchangeSender", - " └─ExchangeSender 32.00 mpp[tiflash] ExchangeType: PassThrough", - " └─HashJoin 32.00 mpp[tiflash] right outer join, equal:[eq(test.fact_t.d1_k, test.d1_t.d1_k)], right cond:gt(test.d1_t.value, 10), other cond:gt(test.fact_t.col1, test.d1_t.value)", - " ├─ExchangeReceiver(Build) 16.00 mpp[tiflash] ", - " │ └─ExchangeSender 16.00 mpp[tiflash] ExchangeType: HashPartition, Hash Cols: [name: test.fact_t.d1_k, collate: binary]", - " │ └─Selection 16.00 mpp[tiflash] not(isnull(test.fact_t.col1)), not(isnull(test.fact_t.d1_k))", - " │ └─TableFullScan 16.00 mpp[tiflash] table:fact_t keep order:false", - " └─ExchangeReceiver(Probe) 4.00 mpp[tiflash] ", - " └─ExchangeSender 4.00 mpp[tiflash] ExchangeType: HashPartition, Hash Cols: [name: test.d1_t.d1_k, collate: binary]", - " └─TableFullScan 4.00 mpp[tiflash] table:d1_t keep order:false" + "HashAgg 1.00 root funcs:count(Column#12)->Column#11", + "└─TableReader 1.00 root data:ExchangeSender", + " └─ExchangeSender 1.00 mpp[tiflash] ExchangeType: PassThrough", + " └─HashAgg 1.00 mpp[tiflash] funcs:count(1)->Column#12", + " └─HashJoin 32.00 mpp[tiflash] right outer join, equal:[eq(test.fact_t.d1_k, test.d1_t.d1_k)], right cond:gt(test.d1_t.value, 10), other cond:gt(test.fact_t.col1, test.d1_t.value)", + " ├─ExchangeReceiver(Build) 16.00 mpp[tiflash] ", + " │ └─ExchangeSender 16.00 mpp[tiflash] ExchangeType: HashPartition, Hash Cols: [name: test.fact_t.d1_k, collate: binary]", + " │ └─Selection 16.00 mpp[tiflash] not(isnull(test.fact_t.col1)), not(isnull(test.fact_t.d1_k))", + " │ └─TableFullScan 16.00 mpp[tiflash] table:fact_t keep order:false", + " └─ExchangeReceiver(Probe) 4.00 mpp[tiflash] ", + " └─ExchangeSender 4.00 mpp[tiflash] ExchangeType: HashPartition, Hash Cols: [name: test.d1_t.d1_k, collate: binary]", + " └─TableFullScan 4.00 mpp[tiflash] table:d1_t keep order:false" ] }, { "SQL": "explain format = 'brief' select count(*) from fact_t where exists (select 1 from d1_t where d1_k = fact_t.d1_k)", "Plan": [ - "StreamAgg 1.00 root funcs:count(1)->Column#12", - "└─TableReader 12.80 root data:ExchangeSender", - " └─ExchangeSender 12.80 mpp[tiflash] ExchangeType: PassThrough", - " └─HashJoin 12.80 mpp[tiflash] semi join, equal:[eq(test.fact_t.d1_k, test.d1_t.d1_k)]", - " ├─ExchangeReceiver(Build) 4.00 mpp[tiflash] ", - " │ └─ExchangeSender 4.00 mpp[tiflash] ExchangeType: HashPartition, Hash Cols: [name: test.d1_t.d1_k, collate: binary]", - " │ └─Selection 4.00 mpp[tiflash] not(isnull(test.d1_t.d1_k))", - " │ └─TableFullScan 4.00 mpp[tiflash] table:d1_t keep order:false", - " └─ExchangeReceiver(Probe) 16.00 mpp[tiflash] ", - " └─ExchangeSender 16.00 mpp[tiflash] ExchangeType: HashPartition, Hash Cols: [name: test.fact_t.d1_k, collate: binary]", - " └─Selection 16.00 mpp[tiflash] not(isnull(test.fact_t.d1_k))", - " └─TableFullScan 16.00 mpp[tiflash] table:fact_t keep order:false" + "HashAgg 1.00 root funcs:count(Column#13)->Column#12", + "└─TableReader 1.00 root data:ExchangeSender", + " └─ExchangeSender 1.00 mpp[tiflash] ExchangeType: PassThrough", + " └─HashAgg 1.00 mpp[tiflash] funcs:count(1)->Column#13", + " └─HashJoin 12.80 mpp[tiflash] semi join, equal:[eq(test.fact_t.d1_k, test.d1_t.d1_k)]", + " ├─ExchangeReceiver(Build) 4.00 mpp[tiflash] ", + " │ └─ExchangeSender 4.00 mpp[tiflash] ExchangeType: HashPartition, Hash Cols: [name: test.d1_t.d1_k, collate: binary]", + " │ └─Selection 4.00 mpp[tiflash] not(isnull(test.d1_t.d1_k))", + " │ └─TableFullScan 4.00 mpp[tiflash] table:d1_t keep order:false", + " └─ExchangeReceiver(Probe) 16.00 mpp[tiflash] ", + " └─ExchangeSender 16.00 mpp[tiflash] ExchangeType: HashPartition, Hash Cols: [name: test.fact_t.d1_k, collate: binary]", + " └─Selection 16.00 mpp[tiflash] not(isnull(test.fact_t.d1_k))", + " └─TableFullScan 16.00 mpp[tiflash] table:fact_t keep order:false" ] }, { "SQL": "explain format = 'brief' select count(*) from fact_t where exists (select 1 from d1_t where d1_k = fact_t.d1_k and value > fact_t.col1)", "Plan": [ - "StreamAgg 1.00 root funcs:count(1)->Column#12", - "└─TableReader 12.80 root data:ExchangeSender", - " └─ExchangeSender 12.80 mpp[tiflash] ExchangeType: PassThrough", - " └─HashJoin 12.80 mpp[tiflash] semi join, equal:[eq(test.fact_t.d1_k, test.d1_t.d1_k)], other cond:gt(test.d1_t.value, test.fact_t.col1)", - " ├─ExchangeReceiver(Build) 4.00 mpp[tiflash] ", - " │ └─ExchangeSender 4.00 mpp[tiflash] ExchangeType: HashPartition, Hash Cols: [name: test.d1_t.d1_k, collate: binary]", - " │ └─Selection 4.00 mpp[tiflash] not(isnull(test.d1_t.d1_k)), not(isnull(test.d1_t.value))", - " │ └─TableFullScan 4.00 mpp[tiflash] table:d1_t keep order:false", - " └─ExchangeReceiver(Probe) 16.00 mpp[tiflash] ", - " └─ExchangeSender 16.00 mpp[tiflash] ExchangeType: HashPartition, Hash Cols: [name: test.fact_t.d1_k, collate: binary]", - " └─Selection 16.00 mpp[tiflash] not(isnull(test.fact_t.col1)), not(isnull(test.fact_t.d1_k))", - " └─TableFullScan 16.00 mpp[tiflash] table:fact_t keep order:false" + "HashAgg 1.00 root funcs:count(Column#13)->Column#12", + "└─TableReader 1.00 root data:ExchangeSender", + " └─ExchangeSender 1.00 mpp[tiflash] ExchangeType: PassThrough", + " └─HashAgg 1.00 mpp[tiflash] funcs:count(1)->Column#13", + " └─HashJoin 12.80 mpp[tiflash] semi join, equal:[eq(test.fact_t.d1_k, test.d1_t.d1_k)], other cond:gt(test.d1_t.value, test.fact_t.col1)", + " ├─ExchangeReceiver(Build) 4.00 mpp[tiflash] ", + " │ └─ExchangeSender 4.00 mpp[tiflash] ExchangeType: HashPartition, Hash Cols: [name: test.d1_t.d1_k, collate: binary]", + " │ └─Selection 4.00 mpp[tiflash] not(isnull(test.d1_t.d1_k)), not(isnull(test.d1_t.value))", + " │ └─TableFullScan 4.00 mpp[tiflash] table:d1_t keep order:false", + " └─ExchangeReceiver(Probe) 16.00 mpp[tiflash] ", + " └─ExchangeSender 16.00 mpp[tiflash] ExchangeType: HashPartition, Hash Cols: [name: test.fact_t.d1_k, collate: binary]", + " └─Selection 16.00 mpp[tiflash] not(isnull(test.fact_t.col1)), not(isnull(test.fact_t.d1_k))", + " └─TableFullScan 16.00 mpp[tiflash] table:fact_t keep order:false" ] }, { "SQL": "explain format = 'brief' select count(*) from fact_t where not exists (select 1 from d1_t where d1_k = fact_t.d1_k)", "Plan": [ - "StreamAgg 1.00 root funcs:count(1)->Column#12", - "└─TableReader 12.80 root data:ExchangeSender", - " └─ExchangeSender 12.80 mpp[tiflash] ExchangeType: PassThrough", - " └─HashJoin 12.80 mpp[tiflash] anti semi join, equal:[eq(test.fact_t.d1_k, test.d1_t.d1_k)]", - " ├─ExchangeReceiver(Build) 4.00 mpp[tiflash] ", - " │ └─ExchangeSender 4.00 mpp[tiflash] ExchangeType: HashPartition, Hash Cols: [name: test.d1_t.d1_k, collate: binary]", - " │ └─TableFullScan 4.00 mpp[tiflash] table:d1_t keep order:false", - " └─ExchangeReceiver(Probe) 16.00 mpp[tiflash] ", - " └─ExchangeSender 16.00 mpp[tiflash] ExchangeType: HashPartition, Hash Cols: [name: test.fact_t.d1_k, collate: binary]", - " └─TableFullScan 16.00 mpp[tiflash] table:fact_t keep order:false" + "HashAgg 1.00 root funcs:count(Column#13)->Column#12", + "└─TableReader 1.00 root data:ExchangeSender", + " └─ExchangeSender 1.00 mpp[tiflash] ExchangeType: PassThrough", + " └─HashAgg 1.00 mpp[tiflash] funcs:count(1)->Column#13", + " └─HashJoin 12.80 mpp[tiflash] anti semi join, equal:[eq(test.fact_t.d1_k, test.d1_t.d1_k)]", + " ├─ExchangeReceiver(Build) 4.00 mpp[tiflash] ", + " │ └─ExchangeSender 4.00 mpp[tiflash] ExchangeType: HashPartition, Hash Cols: [name: test.d1_t.d1_k, collate: binary]", + " │ └─TableFullScan 4.00 mpp[tiflash] table:d1_t keep order:false", + " └─ExchangeReceiver(Probe) 16.00 mpp[tiflash] ", + " └─ExchangeSender 16.00 mpp[tiflash] ExchangeType: HashPartition, Hash Cols: [name: test.fact_t.d1_k, collate: binary]", + " └─TableFullScan 16.00 mpp[tiflash] table:fact_t keep order:false" ] }, { "SQL": "explain format = 'brief' select count(*) from fact_t where not exists (select 1 from d1_t where d1_k = fact_t.d1_k and value > fact_t.col1)", "Plan": [ - "StreamAgg 1.00 root funcs:count(1)->Column#12", - "└─TableReader 12.80 root data:ExchangeSender", - " └─ExchangeSender 12.80 mpp[tiflash] ExchangeType: PassThrough", - " └─HashJoin 12.80 mpp[tiflash] anti semi join, equal:[eq(test.fact_t.d1_k, test.d1_t.d1_k)], other cond:gt(test.d1_t.value, test.fact_t.col1)", - " ├─ExchangeReceiver(Build) 4.00 mpp[tiflash] ", - " │ └─ExchangeSender 4.00 mpp[tiflash] ExchangeType: HashPartition, Hash Cols: [name: test.d1_t.d1_k, collate: binary]", - " │ └─TableFullScan 4.00 mpp[tiflash] table:d1_t keep order:false", - " └─ExchangeReceiver(Probe) 16.00 mpp[tiflash] ", - " └─ExchangeSender 16.00 mpp[tiflash] ExchangeType: HashPartition, Hash Cols: [name: test.fact_t.d1_k, collate: binary]", - " └─TableFullScan 16.00 mpp[tiflash] table:fact_t keep order:false" + "HashAgg 1.00 root funcs:count(Column#13)->Column#12", + "└─TableReader 1.00 root data:ExchangeSender", + " └─ExchangeSender 1.00 mpp[tiflash] ExchangeType: PassThrough", + " └─HashAgg 1.00 mpp[tiflash] funcs:count(1)->Column#13", + " └─HashJoin 12.80 mpp[tiflash] anti semi join, equal:[eq(test.fact_t.d1_k, test.d1_t.d1_k)], other cond:gt(test.d1_t.value, test.fact_t.col1)", + " ├─ExchangeReceiver(Build) 4.00 mpp[tiflash] ", + " │ └─ExchangeSender 4.00 mpp[tiflash] ExchangeType: HashPartition, Hash Cols: [name: test.d1_t.d1_k, collate: binary]", + " │ └─TableFullScan 4.00 mpp[tiflash] table:d1_t keep order:false", + " └─ExchangeReceiver(Probe) 16.00 mpp[tiflash] ", + " └─ExchangeSender 16.00 mpp[tiflash] ExchangeType: HashPartition, Hash Cols: [name: test.fact_t.d1_k, collate: binary]", + " └─TableFullScan 16.00 mpp[tiflash] table:fact_t keep order:false" ] } ] @@ -5118,30 +5157,33 @@ { "SQL": "desc format = 'brief' select /*+ stream_agg()*/ count(b) from (select id + 1 as b from t)A", "Plan": [ - "StreamAgg 1.00 root funcs:count(Column#8)->Column#6", - "└─TableReader 1.00 root data:StreamAgg", - " └─StreamAgg 1.00 batchCop[tiflash] funcs:count(Column#11)->Column#8", - " └─Projection 10000.00 batchCop[tiflash] plus(test.t.id, 1)->Column#11", - " └─TableFullScan 10000.00 batchCop[tiflash] table:t keep order:false, stats:pseudo" + "HashAgg 1.00 root funcs:count(Column#10)->Column#6", + "└─TableReader 1.00 root data:ExchangeSender", + " └─ExchangeSender 1.00 mpp[tiflash] ExchangeType: PassThrough", + " └─HashAgg 1.00 mpp[tiflash] funcs:count(Column#11)->Column#10", + " └─Projection 10000.00 mpp[tiflash] plus(test.t.id, 1)->Column#11", + " └─TableFullScan 10000.00 mpp[tiflash] table:t keep order:false, stats:pseudo" ] }, { "SQL": "desc format = 'brief' select /*+ stream_agg()*/ count(*) from (select id + 1 as b from t)A", "Plan": [ - "StreamAgg 1.00 root funcs:count(Column#7)->Column#6", - "└─TableReader 1.00 root data:StreamAgg", - " └─StreamAgg 1.00 batchCop[tiflash] funcs:count(1)->Column#7", - " └─TableFullScan 10000.00 batchCop[tiflash] table:t keep order:false, stats:pseudo" + "HashAgg 1.00 root funcs:count(Column#9)->Column#6", + "└─TableReader 1.00 root data:ExchangeSender", + " └─ExchangeSender 1.00 mpp[tiflash] ExchangeType: PassThrough", + " └─HashAgg 1.00 mpp[tiflash] funcs:count(1)->Column#9", + " └─TableFullScan 10000.00 mpp[tiflash] table:t keep order:false, stats:pseudo" ] }, { "SQL": "desc format = 'brief' select /*+ stream_agg()*/ sum(b) from (select id + 1 as b from t)A", "Plan": [ - "StreamAgg 1.00 root funcs:sum(Column#8)->Column#6", - "└─TableReader 1.00 root data:StreamAgg", - " └─StreamAgg 1.00 batchCop[tiflash] funcs:sum(Column#11)->Column#8", - " └─Projection 10000.00 batchCop[tiflash] cast(plus(test.t.id, 1), decimal(20,0) BINARY)->Column#11", - " └─TableFullScan 10000.00 batchCop[tiflash] table:t keep order:false, stats:pseudo" + "HashAgg 1.00 root funcs:sum(Column#10)->Column#6", + "└─TableReader 1.00 root data:ExchangeSender", + " └─ExchangeSender 1.00 mpp[tiflash] ExchangeType: PassThrough", + " └─HashAgg 1.00 mpp[tiflash] funcs:sum(Column#11)->Column#10", + " └─Projection 10000.00 mpp[tiflash] cast(plus(test.t.id, 1), decimal(20,0) BINARY)->Column#11", + " └─TableFullScan 10000.00 mpp[tiflash] table:t keep order:false, stats:pseudo" ] }, { @@ -5919,18 +5961,19 @@ { "SQL": "desc format = 'brief' select count(distinct x ) from (select count(distinct value) x from t) t", "Plan": [ - "StreamAgg 1.00 root funcs:count(distinct Column#4)->Column#5", - "└─TableReader 1.00 root data:ExchangeSender", - " └─ExchangeSender 1.00 mpp[tiflash] ExchangeType: PassThrough", - " └─Projection 1.00 mpp[tiflash] Column#4", - " └─HashAgg 1.00 mpp[tiflash] funcs:sum(Column#6)->Column#4", - " └─ExchangeReceiver 1.00 mpp[tiflash] ", - " └─ExchangeSender 1.00 mpp[tiflash] ExchangeType: PassThrough", - " └─HashAgg 1.00 mpp[tiflash] funcs:count(distinct test.t.value)->Column#6", - " └─ExchangeReceiver 1.00 mpp[tiflash] ", - " └─ExchangeSender 1.00 mpp[tiflash] ExchangeType: HashPartition, Hash Cols: [name: test.t.value, collate: binary]", - " └─HashAgg 1.00 mpp[tiflash] group by:test.t.value, ", - " └─TableFullScan 10000.00 mpp[tiflash] table:t keep order:false, stats:pseudo" + "TableReader 1.00 root data:ExchangeSender", + "└─ExchangeSender 1.00 mpp[tiflash] ExchangeType: PassThrough", + " └─Projection 1.00 mpp[tiflash] Column#5", + " └─HashAgg 1.00 mpp[tiflash] funcs:count(distinct Column#4)->Column#5", + " └─Projection 1.00 mpp[tiflash] Column#4", + " └─HashAgg 1.00 mpp[tiflash] funcs:sum(Column#7)->Column#4", + " └─ExchangeReceiver 1.00 mpp[tiflash] ", + " └─ExchangeSender 1.00 mpp[tiflash] ExchangeType: PassThrough", + " └─HashAgg 1.00 mpp[tiflash] funcs:count(distinct test.t.value)->Column#7", + " └─ExchangeReceiver 1.00 mpp[tiflash] ", + " └─ExchangeSender 1.00 mpp[tiflash] ExchangeType: HashPartition, Hash Cols: [name: test.t.value, collate: binary]", + " └─HashAgg 1.00 mpp[tiflash] group by:test.t.value, ", + " └─TableFullScan 10000.00 mpp[tiflash] table:t keep order:false, stats:pseudo" ] }, { @@ -6144,7 +6187,7 @@ { "SQL": "desc format = 'brief' select count(*) from (select t.id, t.value v1 from t join t t1 on t.id = t1.id order by t.value limit 20) v group by v.v1", "Plan": [ - "StreamAgg 20.00 root group by:test.t.value, funcs:count(1)->Column#7", + "HashAgg 20.00 root group by:test.t.value, funcs:count(1)->Column#7", "└─TopN 20.00 root test.t.value, offset:0, count:20", " └─TableReader 20.00 root data:ExchangeSender", " └─ExchangeSender 20.00 mpp[tiflash] ExchangeType: PassThrough", diff --git a/planner/core/testdata/join_reorder_suite_out.json b/planner/core/testdata/join_reorder_suite_out.json index 5581a7a690ae0..7289fbd043d00 100644 --- a/planner/core/testdata/join_reorder_suite_out.json +++ b/planner/core/testdata/join_reorder_suite_out.json @@ -6296,7 +6296,7 @@ "Plan": [ "Projection 1.00 root test.t1.a, Column#14", "└─Apply 1.00 root CARTESIAN left outer join", - " ├─StreamAgg(Build) 1.00 root funcs:min(test.t1.a)->Column#10, funcs:firstrow(test.t1.a)->test.t1.a", + " ├─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)", " │ ├─IndexReader(Build) 3.00 root index:IndexFullScan", " │ │ └─IndexFullScan 3.00 cop[tikv] table:t3, index:a(a) keep order:false", @@ -6915,7 +6915,7 @@ "Plan": [ "Projection 1.00 root test.t1.a, Column#14", "└─Apply 1.00 root CARTESIAN left outer join", - " ├─StreamAgg(Build) 1.00 root funcs:min(test.t1.a)->Column#10, funcs:firstrow(test.t1.a)->test.t1.a", + " ├─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)", " │ ├─IndexReader(Build) 3.00 root index:IndexFullScan", " │ │ └─IndexFullScan 3.00 cop[tikv] table:t3, index:a(a) keep order:false", @@ -6935,7 +6935,7 @@ "Plan": [ "Projection 1.00 root test.t1.a, Column#14", "└─Apply 1.00 root CARTESIAN left outer join", - " ├─StreamAgg(Build) 1.00 root funcs:min(test.t1.a)->Column#10, funcs:firstrow(test.t1.a)->test.t1.a", + " ├─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)", " │ ├─IndexReader(Build) 3.00 root index:IndexFullScan", " │ │ └─IndexFullScan 3.00 cop[tikv] table:t3, index:a(a) keep order:false", @@ -6957,7 +6957,7 @@ "Plan": [ "Projection 1.00 root test.t1.a, Column#14", "└─Apply 1.00 root CARTESIAN left outer join", - " ├─StreamAgg(Build) 1.00 root funcs:min(test.t1.a)->Column#10, funcs:firstrow(test.t1.a)->test.t1.a", + " ├─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)", " │ ├─IndexReader(Build) 3.00 root index:IndexFullScan", " │ │ └─IndexFullScan 3.00 cop[tikv] table:t3, index:a(a) keep order:false", @@ -6979,7 +6979,7 @@ "Plan": [ "Projection 1.00 root test.t1.a, Column#14", "└─Apply 1.00 root CARTESIAN left outer join", - " ├─StreamAgg(Build) 1.00 root funcs:min(test.t1.a)->Column#10, funcs:firstrow(test.t1.a)->test.t1.a", + " ├─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)", " │ ├─IndexReader(Build) 3.00 root index:IndexFullScan", " │ │ └─IndexFullScan 3.00 cop[tikv] table:t3, index:a(a) keep order:false", @@ -7002,7 +7002,7 @@ "Plan": [ "Projection 1.00 root test.t1.a, Column#14", "└─Apply 1.00 root CARTESIAN left outer join", - " ├─StreamAgg(Build) 1.00 root funcs:min(test.t1.a)->Column#10, funcs:firstrow(test.t1.a)->test.t1.a", + " ├─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)", " │ ├─IndexReader(Build) 3.00 root index:IndexFullScan", " │ │ └─IndexFullScan 3.00 cop[tikv] table:t3, index:a(a) keep order:false", @@ -7024,7 +7024,7 @@ "Plan": [ "Projection 1.00 root test.t1.a, Column#14", "└─Apply 1.00 root CARTESIAN left outer join", - " ├─StreamAgg(Build) 1.00 root funcs:min(test.t1.a)->Column#10, funcs:firstrow(test.t1.a)->test.t1.a", + " ├─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)", " │ ├─IndexReader(Build) 3.00 root index:IndexFullScan", " │ │ └─IndexFullScan 3.00 cop[tikv] table:t3, index:a(a) keep order:false", @@ -7049,10 +7049,11 @@ "├─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)", "│ │ ├─Selection(Build) 2.40 root not(isnull(Column#13))", - "│ │ │ └─HashAgg 3.00 root group by:test.t3.b, funcs:max(test.t3.a)->Column#13, funcs:firstrow(test.t3.b)->test.t3.b", - "│ │ │ └─TableReader 3.00 root data:Selection", - "│ │ │ └─Selection 3.00 cop[tikv] not(isnull(test.t3.b))", - "│ │ │ └─TableFullScan 3.00 cop[tikv] table:t3 keep order:false", + "│ │ │ └─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", + "│ │ │ └─HashAgg 3.00 cop[tikv] group by:test.t3.b, funcs:max(test.t3.a)->Column#20", + "│ │ │ └─Selection 3.00 cop[tikv] not(isnull(test.t3.b))", + "│ │ │ └─TableFullScan 3.00 cop[tikv] table:t3 keep order:false", "│ │ └─IndexLookUp(Probe) 3.00 root ", "│ │ ├─Selection(Build) 3.00 cop[tikv] not(isnull(test.t1.a))", "│ │ │ └─IndexRangeScan 3.01 cop[tikv] table:t1, index:a(a) range: decided by [eq(test.t1.a, Column#13)], keep order:false, stats:pseudo", @@ -7078,10 +7079,11 @@ "└─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)", " ├─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(test.t3.a)->Column#13, funcs:firstrow(test.t3.b)->test.t3.b", - " │ │ └─TableReader 3.00 root data:Selection", - " │ │ └─Selection 3.00 cop[tikv] not(isnull(test.t3.b))", - " │ │ └─TableFullScan 3.00 cop[tikv] table:t3 keep order:false", + " │ │ └─HashAgg 3.00 root group by:test.t3.b, funcs:max(Column#18)->Column#13, funcs:firstrow(test.t3.b)->test.t3.b", + " │ │ └─TableReader 3.00 root data:HashAgg", + " │ │ └─HashAgg 3.00 cop[tikv] group by:test.t3.b, funcs:max(test.t3.a)->Column#18", + " │ │ └─Selection 3.00 cop[tikv] not(isnull(test.t3.b))", + " │ │ └─TableFullScan 3.00 cop[tikv] table:t3 keep order:false", " │ └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t4.b, test.t1.b)]", " │ ├─TableReader(Build) 9980.01 root data:Selection", " │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t1.a)), not(isnull(test.t1.b))", @@ -7103,10 +7105,11 @@ "├─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)", "│ │ ├─Selection(Build) 2.40 root not(isnull(Column#13))", - "│ │ │ └─HashAgg 3.00 root group by:test.t3.b, funcs:max(test.t3.a)->Column#13, funcs:firstrow(test.t3.b)->test.t3.b", - "│ │ │ └─TableReader 3.00 root data:Selection", - "│ │ │ └─Selection 3.00 cop[tikv] not(isnull(test.t3.b))", - "│ │ │ └─TableFullScan 3.00 cop[tikv] table:t3 keep order:false", + "│ │ │ └─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", + "│ │ │ └─HashAgg 3.00 cop[tikv] group by:test.t3.b, funcs:max(test.t3.a)->Column#20", + "│ │ │ └─Selection 3.00 cop[tikv] not(isnull(test.t3.b))", + "│ │ │ └─TableFullScan 3.00 cop[tikv] table:t3 keep order:false", "│ │ └─IndexLookUp(Probe) 3.00 root ", "│ │ ├─Selection(Build) 3.00 cop[tikv] not(isnull(test.t1.a))", "│ │ │ └─IndexRangeScan 3.01 cop[tikv] table:t1, index:a(a) range: decided by [eq(test.t1.a, Column#13)], keep order:false, stats:pseudo", @@ -7131,10 +7134,11 @@ "├─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)", "│ │ ├─Selection(Build) 2.40 root not(isnull(Column#13))", - "│ │ │ └─HashAgg 3.00 root group by:test.t3.b, funcs:max(test.t3.a)->Column#13, funcs:firstrow(test.t3.b)->test.t3.b", - "│ │ │ └─TableReader 3.00 root data:Selection", - "│ │ │ └─Selection 3.00 cop[tikv] not(isnull(test.t3.b))", - "│ │ │ └─TableFullScan 3.00 cop[tikv] table:t3 keep order:false", + "│ │ │ └─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", + "│ │ │ └─HashAgg 3.00 cop[tikv] group by:test.t3.b, funcs:max(test.t3.a)->Column#20", + "│ │ │ └─Selection 3.00 cop[tikv] not(isnull(test.t3.b))", + "│ │ │ └─TableFullScan 3.00 cop[tikv] table:t3 keep order:false", "│ │ └─IndexLookUp(Probe) 3.00 root ", "│ │ ├─Selection(Build) 3.00 cop[tikv] not(isnull(test.t1.a))", "│ │ │ └─IndexRangeScan 3.01 cop[tikv] table:t1, index:a(a) range: decided by [eq(test.t1.a, Column#13)], keep order:false, stats:pseudo", @@ -7160,10 +7164,11 @@ "├─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)", "│ ├─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(test.t3.a)->Column#13, funcs:firstrow(test.t3.b)->test.t3.b", - "│ │ │ └─TableReader 3.00 root data:Selection", - "│ │ │ └─Selection 3.00 cop[tikv] not(isnull(test.t3.b))", - "│ │ │ └─TableFullScan 3.00 cop[tikv] table:t3 keep order:false", + "│ │ │ └─HashAgg 3.00 root group by:test.t3.b, funcs:min(Column#17)->Column#13, funcs:firstrow(test.t3.b)->test.t3.b", + "│ │ │ └─TableReader 3.00 root data:HashAgg", + "│ │ │ └─HashAgg 3.00 cop[tikv] group by:test.t3.b, funcs:min(test.t3.a)->Column#17", + "│ │ │ └─Selection 3.00 cop[tikv] not(isnull(test.t3.b))", + "│ │ │ └─TableFullScan 3.00 cop[tikv] table:t3 keep order:false", "│ │ └─TableReader(Probe) 9980.01 root data:Selection", "│ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t1.a)), not(isnull(test.t1.b))", "│ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", @@ -7187,10 +7192,11 @@ "└─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)", " ├─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(test.t3.a)->Column#13, funcs:firstrow(test.t3.b)->test.t3.b", - " │ │ └─TableReader 3.00 root data:Selection", - " │ │ └─Selection 3.00 cop[tikv] not(isnull(test.t3.b))", - " │ │ └─TableFullScan 3.00 cop[tikv] table:t3 keep order:false", + " │ │ └─HashAgg 3.00 root group by:test.t3.b, funcs:min(Column#18)->Column#13, funcs:firstrow(test.t3.b)->test.t3.b", + " │ │ └─TableReader 3.00 root data:HashAgg", + " │ │ └─HashAgg 3.00 cop[tikv] group by:test.t3.b, funcs:min(test.t3.a)->Column#18", + " │ │ └─Selection 3.00 cop[tikv] not(isnull(test.t3.b))", + " │ │ └─TableFullScan 3.00 cop[tikv] table:t3 keep order:false", " │ └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t4.b, test.t1.b)]", " │ ├─TableReader(Build) 9980.01 root data:Selection", " │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t1.a)), not(isnull(test.t1.b))", @@ -7212,10 +7218,11 @@ "├─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)", "│ ├─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(test.t3.a)->Column#13, funcs:firstrow(test.t3.b)->test.t3.b", - "│ │ │ └─TableReader 3.00 root data:Selection", - "│ │ │ └─Selection 3.00 cop[tikv] not(isnull(test.t3.b))", - "│ │ │ └─TableFullScan 3.00 cop[tikv] table:t3 keep order:false", + "│ │ │ └─HashAgg 3.00 root group by:test.t3.b, funcs:min(Column#17)->Column#13, funcs:firstrow(test.t3.b)->test.t3.b", + "│ │ │ └─TableReader 3.00 root data:HashAgg", + "│ │ │ └─HashAgg 3.00 cop[tikv] group by:test.t3.b, funcs:min(test.t3.a)->Column#17", + "│ │ │ └─Selection 3.00 cop[tikv] not(isnull(test.t3.b))", + "│ │ │ └─TableFullScan 3.00 cop[tikv] table:t3 keep order:false", "│ │ └─TableReader(Probe) 9980.01 root data:Selection", "│ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t1.a)), not(isnull(test.t1.b))", "│ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", @@ -7238,10 +7245,11 @@ "├─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)", "│ ├─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(test.t3.a)->Column#13, funcs:firstrow(test.t3.b)->test.t3.b", - "│ │ │ └─TableReader 3.00 root data:Selection", - "│ │ │ └─Selection 3.00 cop[tikv] not(isnull(test.t3.b))", - "│ │ │ └─TableFullScan 3.00 cop[tikv] table:t3 keep order:false", + "│ │ │ └─HashAgg 3.00 root group by:test.t3.b, funcs:min(Column#17)->Column#13, funcs:firstrow(test.t3.b)->test.t3.b", + "│ │ │ └─TableReader 3.00 root data:HashAgg", + "│ │ │ └─HashAgg 3.00 cop[tikv] group by:test.t3.b, funcs:min(test.t3.a)->Column#17", + "│ │ │ └─Selection 3.00 cop[tikv] not(isnull(test.t3.b))", + "│ │ │ └─TableFullScan 3.00 cop[tikv] table:t3 keep order:false", "│ │ └─TableReader(Probe) 9980.01 root data:Selection", "│ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t1.a)), not(isnull(test.t1.b))", "│ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", diff --git a/planner/core/testdata/stats_suite_out.json b/planner/core/testdata/stats_suite_out.json index 38eb118c4556c..03af4766d0995 100644 --- a/planner/core/testdata/stats_suite_out.json +++ b/planner/core/testdata/stats_suite_out.json @@ -218,23 +218,23 @@ { "SQL": "select count(1) from t1 left join t2 on t1.a = t2.a group by t1.a, t1.b", "Plan": [ - "StreamAgg 4.00 root group by:test.t1.a, test.t1.b, funcs:count(1)->Column#7", - "└─IndexJoin 12.00 root left outer join, inner:IndexReader, outer key:test.t1.a, inner key:test.t2.a, equal cond:eq(test.t1.a, test.t2.a)", - " ├─IndexReader(Build) 4.00 root index:IndexFullScan", - " │ └─IndexFullScan 4.00 cop[tikv] table:t1, index:a(a, b) keep order:true", - " └─IndexReader(Probe) 12.00 root index:IndexRangeScan", - " └─IndexRangeScan 12.00 cop[tikv] table:t2, index:a(a, b) range: decided by [eq(test.t2.a, test.t1.a)], keep order:false" + "HashAgg 4.00 root group by:test.t1.a, test.t1.b, funcs:count(1)->Column#7", + "└─MergeJoin 12.00 root left outer join, left key:test.t1.a, right key:test.t2.a", + " ├─IndexReader(Build) 9.00 root index:IndexFullScan", + " │ └─IndexFullScan 9.00 cop[tikv] table:t2, index:a(a, b) keep order:true", + " └─IndexReader(Probe) 4.00 root index:IndexFullScan", + " └─IndexFullScan 4.00 cop[tikv] table:t1, index:a(a, b) keep order:true" ] }, { "SQL": "select count(1) from t1 right join t2 on t1.a = t2.a group by t2.a, t2.b", "Plan": [ - "StreamAgg 9.00 root group by:test.t2.a, test.t2.b, funcs:count(1)->Column#7", - "└─IndexJoin 12.00 root right outer join, inner:IndexReader, outer key:test.t2.a, inner key:test.t1.a, equal cond:eq(test.t2.a, test.t1.a)", - " ├─IndexReader(Build) 9.00 root index:IndexFullScan", - " │ └─IndexFullScan 9.00 cop[tikv] table:t2, index:a(a, b) keep order:true", - " └─IndexReader(Probe) 12.00 root index:IndexRangeScan", - " └─IndexRangeScan 12.00 cop[tikv] table:t1, index:a(a, b) range: decided by [eq(test.t1.a, test.t2.a)], keep order:false" + "HashAgg 9.00 root group by:test.t2.a, test.t2.b, funcs:count(1)->Column#7", + "└─MergeJoin 12.00 root right outer join, left key:test.t1.a, right key:test.t2.a", + " ├─IndexReader(Build) 4.00 root index:IndexFullScan", + " │ └─IndexFullScan 4.00 cop[tikv] table:t1, index:a(a, b) keep order:true", + " └─IndexReader(Probe) 9.00 root index:IndexFullScan", + " └─IndexFullScan 9.00 cop[tikv] table:t2, index:a(a, b) keep order:true" ] }, { From f3e1c737f12d30f4026b9f4d5ca4ef999a4ced93 Mon Sep 17 00:00:00 2001 From: qw4990 Date: Fri, 11 Nov 2022 12:47:37 +0800 Subject: [PATCH 12/17] fixup --- planner/core/testdata/analyze_suite_out.json | 12 +++---- .../core/testdata/integration_suite_out.json | 31 ++++++++++--------- planner/core/testdata/plan_suite_out.json | 2 +- util/ranger/testdata/ranger_suite_out.json | 2 +- 4 files changed, 24 insertions(+), 23 deletions(-) diff --git a/planner/core/testdata/analyze_suite_out.json b/planner/core/testdata/analyze_suite_out.json index ae93f03ac6c9e..3d371f0d609be 100644 --- a/planner/core/testdata/analyze_suite_out.json +++ b/planner/core/testdata/analyze_suite_out.json @@ -435,15 +435,15 @@ "Cases": [ "IndexReader(Index(t.e)[[NULL,+inf]]->StreamAgg)->StreamAgg", "IndexReader(Index(t.e)[[-inf,10]]->StreamAgg)->StreamAgg", - "IndexReader(Index(t.e)[[-inf,50]]->StreamAgg)->StreamAgg", + "IndexReader(Index(t.e)[[-inf,50]]->HashAgg)->HashAgg", "IndexReader(Index(t.b_c)[[NULL,+inf]]->Sel([gt(test.t.c, 1)])->StreamAgg)->StreamAgg", "IndexLookUp(Index(t.e)[[1,1]], Table(t))->HashAgg", "TableReader(Table(t)->Sel([gt(test.t.e, 1)])->HashAgg)->HashAgg", - "TableReader(Table(t)->Sel([le(test.t.b, 20)])->StreamAgg)->StreamAgg", - "TableReader(Table(t)->Sel([le(test.t.b, 30)])->StreamAgg)->StreamAgg", - "TableReader(Table(t)->Sel([le(test.t.b, 40)])->StreamAgg)->StreamAgg", - "TableReader(Table(t)->Sel([le(test.t.b, 50)])->StreamAgg)->StreamAgg", - "TableReader(Table(t)->Sel([le(test.t.b, 100000000000)])->StreamAgg)->StreamAgg", + "TableReader(Table(t)->Sel([le(test.t.b, 20)])->HashAgg)->HashAgg", + "TableReader(Table(t)->Sel([le(test.t.b, 30)])->HashAgg)->HashAgg", + "TableReader(Table(t)->Sel([le(test.t.b, 40)])->HashAgg)->HashAgg", + "TableReader(Table(t)->Sel([le(test.t.b, 50)])->HashAgg)->HashAgg", + "TableReader(Table(t)->Sel([le(test.t.b, 100000000000)])->HashAgg)->HashAgg", "TableReader(Table(t)->Sel([le(test.t.b, 40)]))", "TableReader(Table(t)->Sel([le(test.t.b, 50)]))", "TableReader(Table(t)->Sel([le(test.t.b, 10000000000)]))", diff --git a/planner/core/testdata/integration_suite_out.json b/planner/core/testdata/integration_suite_out.json index 28b80a4ed218e..14c79f6176092 100644 --- a/planner/core/testdata/integration_suite_out.json +++ b/planner/core/testdata/integration_suite_out.json @@ -4207,18 +4207,19 @@ "SQL": "desc format = 'brief' select avg(a) from t", "Plan": [ "HashAgg 1.00 root funcs:avg(Column#5, Column#6)->Column#4", - "└─IndexReader 1.00 root index:HashAgg", - " └─HashAgg 1.00 cop[tikv] funcs:count(test.t.a)->Column#5, funcs:sum(test.t.a)->Column#6", - " └─IndexFullScan 10000.00 cop[tikv] table:t, index:ia(a) keep order:false, stats:pseudo" + "└─TableReader 1.00 root data:HashAgg", + " └─HashAgg 1.00 batchCop[tiflash] funcs:count(Column#9)->Column#5, funcs:sum(Column#10)->Column#6", + " └─Projection 10000.00 batchCop[tiflash] test.t.a, cast(test.t.a, decimal(10,0) BINARY)->Column#10", + " └─TableFullScan 10000.00 batchCop[tiflash] table:t keep order:false, stats:pseudo" ], "Warn": null }, { "SQL": "desc format = 'brief' select /*+ read_from_storage(tiflash[t]) */ avg(a) from t", "Plan": [ - "StreamAgg 1.00 root funcs:avg(Column#7, Column#8)->Column#4", - "└─TableReader 1.00 root data:StreamAgg", - " └─StreamAgg 1.00 batchCop[tiflash] funcs:count(Column#9)->Column#7, funcs:sum(Column#10)->Column#8", + "HashAgg 1.00 root funcs:avg(Column#5, Column#6)->Column#4", + "└─TableReader 1.00 root data:HashAgg", + " └─HashAgg 1.00 batchCop[tiflash] funcs:count(Column#9)->Column#5, funcs:sum(Column#10)->Column#6", " └─Projection 10000.00 batchCop[tiflash] test.t.a, cast(test.t.a, decimal(10,0) BINARY)->Column#10", " └─TableFullScan 10000.00 batchCop[tiflash] table:t keep order:false, stats:pseudo" ], @@ -4227,9 +4228,9 @@ { "SQL": "desc format = 'brief' select /*+ read_from_storage(tiflash[t]) */ sum(a) from t", "Plan": [ - "StreamAgg 1.00 root funcs:sum(Column#6)->Column#4", - "└─TableReader 1.00 root data:StreamAgg", - " └─StreamAgg 1.00 batchCop[tiflash] funcs:sum(Column#7)->Column#6", + "HashAgg 1.00 root funcs:sum(Column#5)->Column#4", + "└─TableReader 1.00 root data:HashAgg", + " └─HashAgg 1.00 batchCop[tiflash] funcs:sum(Column#7)->Column#5", " └─Projection 10000.00 batchCop[tiflash] cast(test.t.a, decimal(10,0) BINARY)->Column#7", " └─TableFullScan 10000.00 batchCop[tiflash] table:t keep order:false, stats:pseudo" ], @@ -4238,9 +4239,9 @@ { "SQL": "desc format = 'brief' select /*+ read_from_storage(tiflash[t]) */ sum(a+1) from t", "Plan": [ - "StreamAgg 1.00 root funcs:sum(Column#6)->Column#4", - "└─TableReader 1.00 root data:StreamAgg", - " └─StreamAgg 1.00 batchCop[tiflash] funcs:sum(Column#7)->Column#6", + "HashAgg 1.00 root funcs:sum(Column#5)->Column#4", + "└─TableReader 1.00 root data:HashAgg", + " └─HashAgg 1.00 batchCop[tiflash] funcs:sum(Column#7)->Column#5", " └─Projection 10000.00 batchCop[tiflash] cast(plus(test.t.a, 1), decimal(20,0) BINARY)->Column#7", " └─TableFullScan 10000.00 batchCop[tiflash] table:t keep order:false, stats:pseudo" ], @@ -4249,9 +4250,9 @@ { "SQL": "desc format = 'brief' select /*+ read_from_storage(tiflash[t]) */ sum(isnull(a)) from t", "Plan": [ - "StreamAgg 1.00 root funcs:sum(Column#6)->Column#4", - "└─TableReader 1.00 root data:StreamAgg", - " └─StreamAgg 1.00 batchCop[tiflash] funcs:sum(Column#7)->Column#6", + "HashAgg 1.00 root funcs:sum(Column#5)->Column#4", + "└─TableReader 1.00 root data:HashAgg", + " └─HashAgg 1.00 batchCop[tiflash] funcs:sum(Column#7)->Column#5", " └─Projection 10000.00 batchCop[tiflash] cast(isnull(test.t.a), decimal(20,0) BINARY)->Column#7", " └─TableFullScan 10000.00 batchCop[tiflash] table:t keep order:false, stats:pseudo" ], diff --git a/planner/core/testdata/plan_suite_out.json b/planner/core/testdata/plan_suite_out.json index ad66ce13ee3f0..1de630dfa7dda 100644 --- a/planner/core/testdata/plan_suite_out.json +++ b/planner/core/testdata/plan_suite_out.json @@ -963,7 +963,7 @@ }, { "SQL": "select sum(e), avg(e + c) from t where c = 1 group by e", - "Best": "IndexReader(Index(t.c_d_e)[[1,1]])->Projection->HashAgg" + "Best": "IndexReader(Index(t.c_d_e)[[1,1]]->HashAgg)->HashAgg" }, { "SQL": "select sum(e), avg(b + c) from t where c = 1 and e = 1 group by d", diff --git a/util/ranger/testdata/ranger_suite_out.json b/util/ranger/testdata/ranger_suite_out.json index 4a4f0c85e2682..3934ff2f7bad3 100644 --- a/util/ranger/testdata/ranger_suite_out.json +++ b/util/ranger/testdata/ranger_suite_out.json @@ -9,7 +9,7 @@ "└─Apply 2.00 root CARTESIAN left outer semi join, other cond:eq(test.t.e, Column#26)", " ├─TableReader(Build) 2.00 root data:TableFullScan", " │ └─TableFullScan 2.00 cop[tikv] table:t keep order:false", - " └─StreamAgg(Probe) 2.00 root funcs:count(1)->Column#26", + " └─HashAgg(Probe) 2.00 root funcs:count(1)->Column#26", " └─HashJoin 4.00 root inner join, equal:[eq(test.t.a, test.t.a)]", " ├─IndexReader(Build) 4.00 root index:IndexFullScan", " │ └─IndexFullScan 4.00 cop[tikv] table:t1, index:idx(b, c, d) keep order:false", From 91f518ad0cc6e8148e954506d71fce71df7f9b1c Mon Sep 17 00:00:00 2001 From: qw4990 Date: Fri, 11 Nov 2022 12:48:19 +0800 Subject: [PATCH 13/17] fixup --- planner/core/testdata/plan_suite_out.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/planner/core/testdata/plan_suite_out.json b/planner/core/testdata/plan_suite_out.json index 1de630dfa7dda..97b38ba60e995 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->IndexReader(Index(t.g)[[NULL,NULL]])}(test.t.d,test.t.g)}->HashAgg" + "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" } ] }, From 41b50710b0853d04dd8527ba2c615e0effb95851 Mon Sep 17 00:00:00 2001 From: qw4990 Date: Fri, 11 Nov 2022 12:48:52 +0800 Subject: [PATCH 14/17] fixup --- planner/core/testdata/plan_suite_out.json | 44 ++++++++++++----------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/planner/core/testdata/plan_suite_out.json b/planner/core/testdata/plan_suite_out.json index 97b38ba60e995..b385d1ba4376b 100644 --- a/planner/core/testdata/plan_suite_out.json +++ b/planner/core/testdata/plan_suite_out.json @@ -5935,7 +5935,7 @@ "└─Apply 10000.00 root CARTESIAN inner join", " ├─TableReader(Build) 10000.00 root data:TableFullScan", " │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - " └─StreamAgg(Probe) 10000.00 root funcs:max(Column#14)->Column#8, funcs:count(distinct Column#15)->Column#9, funcs:sum(Column#16)->Column#10, funcs:count(1)->Column#11", + " └─HashAgg(Probe) 10000.00 root funcs:max(Column#14)->Column#8, funcs:count(distinct Column#15)->Column#9, funcs:sum(Column#16)->Column#10, funcs:count(1)->Column#11", " └─Projection 10000.00 root test.t2.b, test.t2.b, cast(isnull(test.t2.b), decimal(20,0) BINARY)->Column#16", " └─TableReader 10000.00 root data:TableRangeScan", " └─TableRangeScan 10000.00 cop[tikv] table:t2 range: decided by [eq(test.t2.a, test.t1.b)], keep order:false, stats:pseudo" @@ -5953,7 +5953,7 @@ "└─Apply 10000.00 root CARTESIAN inner join", " ├─TableReader(Build) 10000.00 root data:TableFullScan", " │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - " └─StreamAgg(Probe) 10000.00 root funcs:max(Column#14)->Column#8, funcs:count(distinct Column#15)->Column#9, funcs:sum(Column#16)->Column#10, funcs:count(1)->Column#11", + " └─HashAgg(Probe) 10000.00 root funcs:max(Column#14)->Column#8, funcs:count(distinct Column#15)->Column#9, funcs:sum(Column#16)->Column#10, funcs:count(1)->Column#11", " └─Projection 10000.00 root test.t2.b, test.t2.b, cast(isnull(test.t2.b), decimal(20,0) BINARY)->Column#16", " └─TableReader 10000.00 root data:TableRangeScan", " └─TableRangeScan 10000.00 cop[tikv] table:t2 range: decided by [eq(test.t2.a, test.t1.b)], keep order:false, stats:pseudo" @@ -5971,7 +5971,7 @@ "└─Apply 10000.00 root CARTESIAN inner join", " ├─TableReader(Build) 10000.00 root data:TableFullScan", " │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - " └─StreamAgg(Probe) 10000.00 root funcs:max(Column#19)->Column#8, funcs:sum(Column#20)->Column#9, funcs:count(1)->Column#10", + " └─HashAgg(Probe) 10000.00 root funcs:max(Column#19)->Column#8, funcs:sum(Column#20)->Column#9, funcs:count(1)->Column#10", " └─Projection 10000.00 root test.t2.b, cast(isnull(test.t2.b), decimal(20,0) BINARY)->Column#20", " └─TableReader 10000.00 root data:TableRangeScan", " └─TableRangeScan 10000.00 cop[tikv] table:t2 range: decided by [eq(test.t2.a, test.t1.b)], keep order:false, stats:pseudo" @@ -5989,7 +5989,7 @@ "└─Apply 10000.00 root CARTESIAN inner join", " ├─TableReader(Build) 10000.00 root data:TableFullScan", " │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - " └─StreamAgg(Probe) 10000.00 root funcs:max(Column#19)->Column#8, funcs:sum(Column#20)->Column#9, funcs:count(1)->Column#10", + " └─HashAgg(Probe) 10000.00 root funcs:max(Column#19)->Column#8, funcs:sum(Column#20)->Column#9, funcs:count(1)->Column#10", " └─Projection 10000.00 root test.t2.b, cast(isnull(test.t2.b), decimal(20,0) BINARY)->Column#20", " └─TableReader 10000.00 root data:TableRangeScan", " └─TableRangeScan 10000.00 cop[tikv] table:t2 range: decided by [eq(test.t2.a, test.t1.b)], keep order:false, stats:pseudo" @@ -6104,9 +6104,9 @@ "Projection 1.00 root test.t1.a, Column#6", "└─HashJoin 1.00 root CARTESIAN left outer join", " ├─Point_Get(Build) 1.00 root table:t2 handle:10", - " └─StreamAgg(Probe) 1.00 root funcs:sum(Column#15)->Column#6, funcs:firstrow(Column#16)->test.t1.a", - " └─TableReader 1.00 root data:StreamAgg", - " └─StreamAgg 1.00 cop[tikv] funcs:sum(test.t1.a)->Column#15, funcs:firstrow(test.t1.a)->Column#16", + " └─HashAgg(Probe) 1.00 root funcs:sum(Column#13)->Column#6, funcs:firstrow(Column#14)->test.t1.a", + " └─TableReader 1.00 root data:HashAgg", + " └─HashAgg 1.00 cop[tikv] funcs:sum(test.t1.a)->Column#13, funcs:firstrow(test.t1.a)->Column#14", " └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo" ], "Result": [ @@ -6159,9 +6159,9 @@ " ├─TableReader(Build) 10000.00 root data:TableFullScan", " │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", " └─MaxOneRow(Probe) 10000.00 root ", - " └─StreamAgg 10000.00 root funcs:count(Column#12)->Column#10", - " └─TableReader 10000.00 root data:StreamAgg", - " └─StreamAgg 10000.00 cop[tikv] funcs:count(test.t3.a)->Column#12", + " └─HashAgg 10000.00 root funcs:count(Column#11)->Column#10", + " └─TableReader 10000.00 root data:HashAgg", + " └─HashAgg 10000.00 cop[tikv] funcs:count(test.t3.a)->Column#11", " └─Selection 100000.00 cop[tikv] eq(test.t3.b, test.t1.b)", " └─TableFullScan 100000000.00 cop[tikv] table:t3 keep order:false, stats:pseudo" ], @@ -6234,7 +6234,7 @@ " │ └─Selection 250.00 cop[tikv] like(test.ta.name, \"chad999%\", 92)", " │ └─TableFullScan 10000.00 cop[tikv] table:ta keep order:false, stats:pseudo", " └─MaxOneRow(Probe) 250.00 root ", - " └─StreamAgg 250.00 root funcs:sum(Column#33)->Column#18", + " └─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)", " ├─IndexLookUp(Build) 2497.50 root ", @@ -6280,7 +6280,7 @@ " │ └─Selection 250.00 cop[tikv] like(test.ta.name, \"chad999%\", 92)", " │ └─TableFullScan 10000.00 cop[tikv] table:ta keep order:false, stats:pseudo", " └─MaxOneRow(Probe) 250.00 root ", - " └─StreamAgg 250.00 root funcs:sum(Column#22)->Column#18", + " └─HashAgg 250.00 root funcs:sum(Column#22)->Column#18", " └─Projection 2500.00 root cast(test.tb.code, decimal(10,0) BINARY)->Column#22", " └─Apply 2500.00 root CARTESIAN semi join", " ├─IndexLookUp(Build) 2500.00 root ", @@ -6323,7 +6323,7 @@ " │ └─TableRowIDScan(Probe) 10.00 cop[tikv] table:ta keep order:false, stats:pseudo", " └─Selection(Probe) 8.00 root gt(Column#9, 900)", " └─MaxOneRow 10.00 root ", - " └─StreamAgg 10.00 root funcs:max(test.tb.code)->Column#9", + " └─HashAgg 10.00 root funcs:max(test.tb.code)->Column#9", " └─TopN 10.00 root test.tb.code:desc, offset:0, count:1", " └─IndexLookUp 10.00 root ", " ├─IndexRangeScan(Build) 100.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", @@ -6339,16 +6339,18 @@ "Plan": [ "HashJoin 159.84 root inner join, equal:[eq(test.ta.id, test.td.id)]", "├─Selection(Build) 159.84 root gt(Column#19, 100)", - "│ └─HashAgg 199.80 root group by:test.td.id, funcs:max(test.td.id)->Column#19, funcs:firstrow(test.td.id)->test.td.id", - "│ └─TableReader 249.75 root data:Selection", - "│ └─Selection 249.75 cop[tikv] like(test.td.name, \"chad999%\", 92), not(isnull(test.td.id))", - "│ └─TableFullScan 10000.00 cop[tikv] table:td keep order:false, stats:pseudo", + "│ └─HashAgg 199.80 root group by:test.td.id, funcs:max(Column#32)->Column#19, funcs:firstrow(test.td.id)->test.td.id", + "│ └─TableReader 199.80 root data:HashAgg", + "│ └─HashAgg 199.80 cop[tikv] group by:test.td.id, funcs:max(test.td.id)->Column#32", + "│ └─Selection 249.75 cop[tikv] like(test.td.name, \"chad999%\", 92), not(isnull(test.td.id))", + "│ └─TableFullScan 10000.00 cop[tikv] table:td keep order:false, stats:pseudo", "└─HashJoin(Probe) 200.00 root inner join, equal:[eq(test.ta.name, test.tc.name)]", " ├─Selection(Build) 160.00 root gt(Column#14, 100)", - " │ └─HashAgg 200.00 root group by:test.tc.name, funcs:max(test.tc.id)->Column#14, funcs:firstrow(test.tc.name)->test.tc.name", - " │ └─TableReader 250.00 root data:Selection", - " │ └─Selection 250.00 cop[tikv] like(test.tc.name, \"chad99%\", 92), not(isnull(test.tc.name))", - " │ └─TableFullScan 10000.00 cop[tikv] table:tc keep order:false, stats:pseudo", + " │ └─HashAgg 200.00 root group by:test.tc.name, funcs:max(Column#24)->Column#14, funcs:firstrow(test.tc.name)->test.tc.name", + " │ └─TableReader 200.00 root data:HashAgg", + " │ └─HashAgg 200.00 cop[tikv] group by:test.tc.name, funcs:max(test.tc.id)->Column#24", + " │ └─Selection 250.00 cop[tikv] like(test.tc.name, \"chad99%\", 92), not(isnull(test.tc.name))", + " │ └─TableFullScan 10000.00 cop[tikv] table:tc keep order:false, stats:pseudo", " └─HashJoin(Probe) 7976.02 root semi join, equal:[eq(test.ta.code, test.tb.code)]", " ├─TableReader(Build) 249.75 root data:Selection", " │ └─Selection 249.75 cop[tikv] like(test.tb.name, \"chad9%\", 92), not(isnull(test.tb.code))", From 90cbff32552edde22f9e9fbe232764e7f452b224 Mon Sep 17 00:00:00 2001 From: qw4990 Date: Fri, 11 Nov 2022 12:52:17 +0800 Subject: [PATCH 15/17] fixup --- planner/core/partition_pruner_test.go | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/planner/core/partition_pruner_test.go b/planner/core/partition_pruner_test.go index 07dddbdb51175..ea23b9c4257ba 100644 --- a/planner/core/partition_pruner_test.go +++ b/planner/core/partition_pruner_test.go @@ -89,14 +89,16 @@ func TestRangeColumnPartitionPruningForIn(t *testing.T) { tk.MustQuery(`explain format='brief' select /*+ HASH_AGG() */ count(1) from t1 where dt in ('2020-11-27','2020-11-28')`).Check( testkit.Rows("HashAgg 1.00 root funcs:count(Column#5)->Column#4", "└─PartitionUnion 2.00 root ", - " ├─HashAgg 1.00 root funcs:count(1)->Column#5", - " │ └─IndexReader 20.00 root index:Selection", - " │ └─Selection 20.00 cop[tikv] in(test_range_col_in.t1.dt, 2020-11-27 00:00:00.000000, 2020-11-28 00:00:00.000000)", - " │ └─IndexFullScan 10000.00 cop[tikv] table:t1, partition:p20201127, index:PRIMARY(id, dt) keep order:false, stats:pseudo", - " └─HashAgg 1.00 root funcs:count(1)->Column#5", - " └─IndexReader 20.00 root index:Selection", - " └─Selection 20.00 cop[tikv] in(test_range_col_in.t1.dt, 2020-11-27 00:00:00.000000, 2020-11-28 00:00:00.000000)", - " └─IndexFullScan 10000.00 cop[tikv] table:t1, partition:p20201128, index:PRIMARY(id, dt) keep order:false, stats:pseudo")) + " ├─HashAgg 1.00 root funcs:count(Column#7)->Column#5", + " │ └─IndexReader 1.00 root index:HashAgg", + " │ └─HashAgg 1.00 cop[tikv] funcs:count(1)->Column#7", + " │ └─Selection 20.00 cop[tikv] in(test_range_col_in.t1.dt, 2020-11-27 00:00:00.000000, 2020-11-28 00:00:00.000000)", + " │ └─IndexFullScan 10000.00 cop[tikv] table:t1, partition:p20201127, index:PRIMARY(id, dt) keep order:false, stats:pseudo", + " └─HashAgg 1.00 root funcs:count(Column#10)->Column#5", + " └─IndexReader 1.00 root index:HashAgg", + " └─HashAgg 1.00 cop[tikv] funcs:count(1)->Column#10", + " └─Selection 20.00 cop[tikv] in(test_range_col_in.t1.dt, 2020-11-27 00:00:00.000000, 2020-11-28 00:00:00.000000)", + " └─IndexFullScan 10000.00 cop[tikv] table:t1, partition:p20201128, index:PRIMARY(id, dt) keep order:false, stats:pseudo")) tk.MustExec(`insert into t1 values (1, "2020-11-25")`) tk.MustExec(`insert into t1 values (2, "2020-11-26")`) From 60335afa4b70b21a14fd1d4c4d03c37b4e7cca2e Mon Sep 17 00:00:00 2001 From: qw4990 Date: Fri, 11 Nov 2022 12:55:57 +0800 Subject: [PATCH 16/17] fixup --- planner/core/integration_test.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/planner/core/integration_test.go b/planner/core/integration_test.go index e070fbf4d4965..869ee8984a1de 100644 --- a/planner/core/integration_test.go +++ b/planner/core/integration_test.go @@ -7119,26 +7119,26 @@ func TestAggWithJsonPushDownToTiFlash(t *testing.T) { } rows := [][]interface{}{ - {"HashAgg_8", "root", "funcs:avg(Column#4)->Column#3"}, + {"HashAgg_6", "root", "funcs:avg(Column#4)->Column#3"}, {"└─Projection_19", "root", "cast(test.t.a, double BINARY)->Column#4"}, - {" └─TableReader_14", "root", "data:TableFullScan_13"}, - {" └─TableFullScan_13", "cop[tiflash]", "keep order:false, stats:pseudo"}, + {" └─TableReader_12", "root", "data:TableFullScan_11"}, + {" └─TableFullScan_11", "cop[tiflash]", "keep order:false, stats:pseudo"}, } tk.MustQuery("explain select avg(a) from t;").CheckAt([]int{0, 2, 4}, rows) rows = [][]interface{}{ - {"HashAgg_8", "root", "funcs:sum(Column#4)->Column#3"}, + {"HashAgg_6", "root", "funcs:sum(Column#4)->Column#3"}, {"└─Projection_19", "root", "cast(test.t.a, double BINARY)->Column#4"}, - {" └─TableReader_14", "root", "data:TableFullScan_13"}, - {" └─TableFullScan_13", "cop[tiflash]", "keep order:false, stats:pseudo"}, + {" └─TableReader_12", "root", "data:TableFullScan_11"}, + {" └─TableFullScan_11", "cop[tiflash]", "keep order:false, stats:pseudo"}, } tk.MustQuery("explain select sum(a) from t;").CheckAt([]int{0, 2, 4}, rows) rows = [][]interface{}{ - {"HashAgg_8", "root", "funcs:group_concat(Column#4 separator \",\")->Column#3"}, + {"HashAgg_6", "root", "funcs:group_concat(Column#4 separator \",\")->Column#3"}, {"└─Projection_13", "root", "cast(test.t.a, var_string(4294967295))->Column#4"}, - {" └─TableReader_12", "root", "data:TableFullScan_11"}, - {" └─TableFullScan_11", "cop[tiflash]", "keep order:false, stats:pseudo"}, + {" └─TableReader_10", "root", "data:TableFullScan_9"}, + {" └─TableFullScan_9", "cop[tiflash]", "keep order:false, stats:pseudo"}, } tk.MustQuery("explain select /*+ hash_agg() */ group_concat(a) from t;").CheckAt([]int{0, 2, 4}, rows) } From c0a60cc305ec61410c45b3d393abb45bec5150af Mon Sep 17 00:00:00 2001 From: qw4990 Date: Fri, 11 Nov 2022 13:16:40 +0800 Subject: [PATCH 17/17] fixup --- statistics/testdata/integration_suite_out.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/statistics/testdata/integration_suite_out.json b/statistics/testdata/integration_suite_out.json index 2a150a0f44159..73b62a002e248 100644 --- a/statistics/testdata/integration_suite_out.json +++ b/statistics/testdata/integration_suite_out.json @@ -26,8 +26,8 @@ "└─IndexRangeScan_5 1.36 cop[tikv] table:exp_backoff, index:idx(a, b, c, d) range:[1 1 1 3,1 1 1 5], keep order:false" ], [ - "IndexReader_6 1.36 root index:IndexRangeScan_5", - "└─IndexRangeScan_5 1.36 cop[tikv] table:exp_backoff, index:idx(a, b, c, d) range:[1 1 1 3,1 1 1 5], keep order:false" + "IndexReader_6 0.00 root index:IndexRangeScan_5", + "└─IndexRangeScan_5 0.00 cop[tikv] table:exp_backoff, index:idx(a, b, c, d) range:[1 1 1 3,1 1 1 5], keep order:false" ] ] },