diff --git a/planner/core/casetest/BUILD.bazel b/planner/core/casetest/BUILD.bazel index b3b99e1384d03..58b329c208cc0 100644 --- a/planner/core/casetest/BUILD.bazel +++ b/planner/core/casetest/BUILD.bazel @@ -21,9 +21,7 @@ go_test( "//domain", "//parser", "//parser/model", - "//parser/terror", "//planner/core", - "//planner/core/internal", "//planner/property", "//session", "//sessionctx/stmtctx", diff --git a/planner/core/casetest/hint/BUILD.bazel b/planner/core/casetest/hint/BUILD.bazel new file mode 100644 index 0000000000000..19f6dc60c4261 --- /dev/null +++ b/planner/core/casetest/hint/BUILD.bazel @@ -0,0 +1,28 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_test") + +go_test( + name = "hint_test", + timeout = "short", + srcs = [ + "hint_test.go", + "main_test.go", + ], + data = glob(["testdata/**"]), + flaky = True, + shard_count = 15, + deps = [ + "//domain", + "//parser/model", + "//parser/terror", + "//planner/core", + "//planner/core/internal", + "//sessionctx/stmtctx", + "//sessionctx/variable", + "//testkit", + "//testkit/testdata", + "//testkit/testmain", + "//testkit/testsetup", + "@com_github_stretchr_testify//require", + "@org_uber_go_goleak//:goleak", + ], +) diff --git a/planner/core/casetest/hint/hint_test.go b/planner/core/casetest/hint/hint_test.go new file mode 100644 index 0000000000000..69f650a0a599f --- /dev/null +++ b/planner/core/casetest/hint/hint_test.go @@ -0,0 +1,649 @@ +// Copyright 2023 PingCAP, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package hint + +import ( + "testing" + + "github.com/pingcap/tidb/domain" + "github.com/pingcap/tidb/parser/model" + "github.com/pingcap/tidb/parser/terror" + "github.com/pingcap/tidb/planner/core" + "github.com/pingcap/tidb/planner/core/internal" + "github.com/pingcap/tidb/sessionctx/stmtctx" + "github.com/pingcap/tidb/sessionctx/variable" + "github.com/pingcap/tidb/testkit" + "github.com/pingcap/tidb/testkit/testdata" + "github.com/stretchr/testify/require" +) + +func TestHintInWrongPos(t *testing.T) { + store := testkit.CreateMockStore(t) + tk := testkit.NewTestKit(t, store) + + tk.MustExec("set tidb_cost_model_version=2") + tk.MustExec("use test") + tk.MustExec("drop table if exists t") + tk.MustExec("create table t(a int, b int)") + + tk.MustExec("select /*+ stream_agg() */ count(*) from t where a > 1;") + tk.MustQuery("show warnings").Check(testkit.Rows()) + + tk.MustExec("select count(*) /*+ stream_agg() */ from t where a > 1;") + tk.MustQuery("show warnings").Check(testkit.Rows("Warning 1064 You have an error in your SQL syntax; check the manual that corresponds to your TiDB version for the right syntax to use [parser:8066]Optimizer hint can only be followed by certain keywords like SELECT, INSERT, etc.")) + + tk.MustExec("select count(*) from (select count(*) as a /*+ stream_agg() */ from t where b > 1 group by b) t1 where a > 1;") + tk.MustQuery("show warnings").Check(testkit.Rows("Warning 1064 You have an error in your SQL syntax; check the manual that corresponds to your TiDB version for the right syntax to use [parser:8066]Optimizer hint can only be followed by certain keywords like SELECT, INSERT, etc.")) +} + +func TestReadFromStorageHint(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("drop table if exists t, tt, ttt") + tk.MustExec("set session tidb_allow_mpp=OFF") + // since allow-mpp is adjusted to false, there will be no physical plan if TiFlash cop is banned. + tk.MustExec("set @@session.tidb_allow_tiflash_cop=ON") + tk.MustExec("create table t(a int, b int, index ia(a))") + tk.MustExec("create table tt(a int, b int, primary key(a))") + tk.MustExec("create table ttt(a int, primary key (a desc))") + + // Create virtual tiflash replica info. + dom := domain.GetDomain(tk.Session()) + is := dom.InfoSchema() + db, exists := is.SchemaByName(model.NewCIStr("test")) + require.True(t, exists) + for _, tblInfo := range db.Tables { + tblInfo.TiFlashReplica = &model.TiFlashReplicaInfo{ + Count: 1, + Available: true, + } + } + + var input []string + var output []struct { + SQL string + Plan []string + Warn []string + } + integrationSuiteData := GetIntegrationSuiteData() + integrationSuiteData.LoadTestCases(t, &input, &output) + for i, tt := range input { + testdata.OnRecord(func() { + output[i].SQL = tt + output[i].Plan = testdata.ConvertRowsToStrings(tk.MustQuery(tt).Rows()) + output[i].Warn = testdata.ConvertSQLWarnToStrings(tk.Session().GetSessionVars().StmtCtx.GetWarnings()) + }) + res := tk.MustQuery(tt) + res.Check(testkit.Rows(output[i].Plan...)) + require.Equal(t, output[i].Warn, testdata.ConvertSQLWarnToStrings(tk.Session().GetSessionVars().StmtCtx.GetWarnings())) + } +} + +func TestKeepOrderHint(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("drop table if exists t, t1, th") + tk.MustExec("drop view if exists v, v1") + tk.MustExec("create table t(a int, b int, primary key(a));") + tk.MustExec("create table t1(a int, b int, index idx_a(a));") + tk.MustExec("create table th (a int, key(a)) partition by hash(a) partitions 4;") + tk.MustExec("create table thp (a int, primary key(a)) partition by hash(a) partitions 4;") + tk.MustExec("create table thh (a int, b int, key(a)) partition by hash(a) partitions 4;") + tk.MustExec("create definer='root'@'localhost' view v as select * from t1 where a<10 order by a limit 1;") + tk.MustExec("create definer='root'@'localhost' view v1 as select * from t where a<10 order by a limit 1;") + + // If the optimizer can not generate the keep order plan, it will report error + err := tk.ExecToErr("explain select /*+ order_index(t1, idx_a) */ * from t1 where a<10 limit 1;") + require.EqualError(t, err, "[planner:1815]Internal : Can't find a proper physical plan for this query") + + err = tk.ExecToErr("explain select /*+ order_index(t, primary) */ * from t where a<10 limit 1;") + require.EqualError(t, err, "[planner:1815]Internal : Can't find a proper physical plan for this query") + + tk.MustExec("analyze table th;") + tk.MustExec("analyze table thp;") + tk.MustExec("analyze table thh;") + err = tk.ExecToErr("select a from th where a<1 order by a limit 1;") + require.NoError(t, err) + + err = tk.ExecToErr("select /*+ order_index(thh, a) */ * from thh where a<1 order by a limit 1;") + require.NoError(t, err) + + var input []string + var output []struct { + SQL string + Plan []string + Warn []string + } + integrationSuiteData := GetIntegrationSuiteData() + integrationSuiteData.LoadTestCases(t, &input, &output) + for i, tt := range input { + testdata.OnRecord(func() { + output[i].SQL = tt + output[i].Plan = testdata.ConvertRowsToStrings(tk.MustQuery(tt).Rows()) + output[i].Warn = testdata.ConvertSQLWarnToStrings(tk.Session().GetSessionVars().StmtCtx.GetWarnings()) + }) + res := tk.MustQuery(tt) + res.Check(testkit.Rows(output[i].Plan...)) + require.Equal(t, output[i].Warn, testdata.ConvertSQLWarnToStrings(tk.Session().GetSessionVars().StmtCtx.GetWarnings())) + } +} + +func TestViewHint(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("drop view if exists v, v1, v2") + tk.MustExec("drop table if exists t, t1, t2") + tk.MustExec("create table t(a int, b int);") + tk.MustExec("create table t1(a int, b int);") + tk.MustExec("create table t2(a int, b int);") + tk.MustExec("create definer='root'@'localhost' view v as select t.a, t.b from t join (select count(*) as a from t1 join t2 on t1.b=t2.b group by t2.a) tt on t.a = tt.a;") + tk.MustExec("create definer='root'@'localhost' view v1 as select t.a, t.b from t join (select count(*) as a from t1 join v on t1.b=v.b group by v.a) tt on t.a = tt.a;") + tk.MustExec("create definer='root'@'localhost' view v2 as select t.a, t.b from t join (select count(*) as a from t1 join v1 on t1.b=v1.b group by v1.a) tt on t.a = tt.a;") + + var input []string + var output []struct { + SQL string + Plan []string + Warn []string + } + integrationSuiteData := GetIntegrationSuiteData() + integrationSuiteData.LoadTestCases(t, &input, &output) + for i, tt := range input { + testdata.OnRecord(func() { + output[i].SQL = tt + output[i].Plan = testdata.ConvertRowsToStrings(tk.MustQuery(tt).Rows()) + output[i].Warn = testdata.ConvertSQLWarnToStrings(tk.Session().GetSessionVars().StmtCtx.GetWarnings()) + }) + res := tk.MustQuery(tt) + res.Check(testkit.Rows(output[i].Plan...)) + require.Equal(t, output[i].Warn, testdata.ConvertSQLWarnToStrings(tk.Session().GetSessionVars().StmtCtx.GetWarnings())) + } +} + +func TestViewHintScope(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("drop view if exists v, v1, v2, v3, v4") + tk.MustExec("drop table if exists t, t1, t2, t3, t4") + tk.MustExec("create table t(a int, b int);") + tk.MustExec("create table t1(a int, b int);") + tk.MustExec("create table t2(a int, b int);") + tk.MustExec("create table t3(a int, b int)") + tk.MustExec("create table t4(a int, b int, index idx_a(a), index idx_b(b))") + tk.MustExec("create definer='root'@'localhost' view v as select t.a, t.b from t join (select count(*) as a from t1 join t2 join t3 where t1.b=t2.b and t2.a = t3.a group by t2.a) tt on t.a = tt.a;") + tk.MustExec("create definer='root'@'localhost' view v1 as select t.a, t.b from t join (select count(*) as a from t1 join v on t1.b=v.b group by v.a) tt on t.a = tt.a;") + tk.MustExec("create definer='root'@'localhost' view v2 as select t.a, t.b from t join (select count(*) as a from t1 join v1 on t1.b=v1.b group by v1.a) tt on t.a = tt.a;") + tk.MustExec("create definer='root'@'localhost' view v3 as select /*+ merge_join(t) */ t.a, t.b from t join (select /*+ stream_agg() */ count(*) as a from t1 join v1 on t1.b=v1.b group by v1.a) tt on t.a = tt.a;") + tk.MustExec("create definer='root'@'localhost' view v4 as select * from t4 where a > 2 and b > 3;") + + var input []string + var output []struct { + SQL string + Plan []string + Warn []string + } + integrationSuiteData := GetIntegrationSuiteData() + integrationSuiteData.LoadTestCases(t, &input, &output) + for i, tt := range input { + testdata.OnRecord(func() { + output[i].SQL = tt + output[i].Plan = testdata.ConvertRowsToStrings(tk.MustQuery(tt).Rows()) + output[i].Warn = testdata.ConvertSQLWarnToStrings(tk.Session().GetSessionVars().StmtCtx.GetWarnings()) + }) + res := tk.MustQuery(tt) + res.Check(testkit.Rows(output[i].Plan...)) + require.Equal(t, output[i].Warn, testdata.ConvertSQLWarnToStrings(tk.Session().GetSessionVars().StmtCtx.GetWarnings())) + } +} + +func TestAllViewHintType(t *testing.T) { + store := testkit.CreateMockStore(t, internal.WithMockTiFlash(2)) + tk := testkit.NewTestKit(t, store) + + tk.MustExec("use test") + tk.MustExec("set tidb_cost_model_version=2") + tk.MustExec("set @@session.tidb_allow_mpp=ON") + tk.MustExec("set @@session.tidb_isolation_read_engines='tiflash, tikv'") + tk.MustExec("drop view if exists v, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12") + tk.MustExec("drop table if exists t, t1, t2, t4, t3, t5") + tk.MustExec("create table t(a int not null, b int, index idx_a(a));") + tk.MustExec("create table t1(a int not null, b int, index idx_a(a));") + tk.MustExec("create table t2(a int, b int, index idx_a(a));") + tk.MustExec("create table t3(a int, b int, index idx_a(a));") + tk.MustExec("create table t4(a int, b int, index idx_a(a));") + tk.MustExec("create table t5(a int, b int, index idx_a(a), index idx_b(b));") + + // Create virtual tiflash replica info. + dom := domain.GetDomain(tk.Session()) + is := dom.InfoSchema() + db, exists := is.SchemaByName(model.NewCIStr("test")) + require.True(t, exists) + for _, tblInfo := range db.Tables { + if tblInfo.Name.L == "t" { + tblInfo.TiFlashReplica = &model.TiFlashReplicaInfo{ + Count: 1, + Available: true, + } + } + } + + tk.MustExec("create definer='root'@'localhost' view v as select t.a, t.b from t join t1 on t.a = t1.a;") + tk.MustExec("create definer='root'@'localhost' view v1 as select t2.a, t2.b from t2 join t3 join v where t2.b = t3.b and t3.a = v.a;") + tk.MustExec("create definer='root'@'localhost' view v2 as select t.a, t.b from t join (select count(*) as a from t1 join v1 on t1.b=v1.b group by v1.a) tt on t.a = tt.a;") + tk.MustExec("create definer='root'@'localhost' view v3 as select * from t5 where a > 1 and b < 2;") + tk.MustExec("create definer='root'@'localhost' view v4 as select * from t5 where a > 1 or b < 2;") + tk.MustExec("create definer='root'@'localhost' view v5 as SELECT * FROM t WHERE EXISTS (SELECT 1 FROM t1 WHERE t1.b = t.b);") + tk.MustExec("create definer='root'@'localhost' view v6 as select * from t1 where t1.a < (select sum(t2.a) from t2 where t2.b = t1.b);") + tk.MustExec("create definer='root'@'localhost' view v7 as WITH CTE AS (SELECT * FROM t WHERE t.a < 60) SELECT * FROM CTE WHERE CTE.a <18 union select * from cte where cte.b > 1;") + tk.MustExec("create definer='root'@'localhost' view v8 as WITH CTE1 AS (SELECT b FROM t1), CTE2 AS (WITH CTE3 AS (SELECT a FROM t2), CTE4 AS (SELECT a FROM t3) SELECT CTE3.a FROM CTE3, CTE4) SELECT b FROM CTE1, CTE2 union select * from CTE1;") + tk.MustExec("create definer='root'@'localhost' view v9 as select sum(a) from t;") + tk.MustExec("create definer='root'@'localhost' view v10 as SELECT * FROM t WHERE a > 10 ORDER BY b LIMIT 1;") + tk.MustExec("create definer='root'@'localhost' view v11 as select a, sum(b) from t group by a") + tk.MustExec("create definer='root'@'localhost' view v12 as select t.a, t.b from t join t t1 on t.a = t1.a;") + + var input []string + var output []struct { + SQL string + Plan []string + Warn []string + } + integrationSuiteData := GetIntegrationSuiteData() + integrationSuiteData.LoadTestCases(t, &input, &output) + for i, tt := range input { + testdata.OnRecord(func() { + output[i].SQL = tt + output[i].Plan = testdata.ConvertRowsToStrings(tk.MustQuery(tt).Rows()) + output[i].Warn = testdata.ConvertSQLWarnToStrings(tk.Session().GetSessionVars().StmtCtx.GetWarnings()) + }) + res := tk.MustQuery(tt) + res.Check(testkit.Rows(output[i].Plan...)) + require.Equal(t, output[i].Warn, testdata.ConvertSQLWarnToStrings(tk.Session().GetSessionVars().StmtCtx.GetWarnings())) + } +} + +func TestJoinHintCompatibility(t *testing.T) { + store := testkit.CreateMockStore(t, internal.WithMockTiFlash(2)) + tk := testkit.NewTestKit(t, store) + + tk.MustExec("use test") + tk.MustExec("set tidb_cost_model_version=2") + tk.MustExec("set @@session.tidb_allow_mpp=ON") + tk.MustExec("set @@session.tidb_isolation_read_engines='tiflash, tikv'") + tk.MustExec("drop view if exists v, v1, v2") + tk.MustExec("drop table if exists t, t1, t2, t3, t4, t5, t6, t7, t8, t9;") + tk.MustExec("create table t(a int not null, b int, index idx_a(a), index idx_b(b));") + tk.MustExec("create table t1(a int not null, b int, index idx_a(a), index idx_b(b));") + tk.MustExec("create table t2(a int, b int, index idx_a(a), index idx_b(b));") + tk.MustExec("create table t3(a int, b int, index idx_a(a), index idx_b(b));") + tk.MustExec("create table t4(a int, b int, index idx_a(a), index idx_b(b));") + tk.MustExec("create table t5(a int, b int, index idx_a(a), index idx_b(b));") + tk.MustExec("create table t6(a int, b int, index idx_a(a), index idx_b(b));") + tk.MustExec("create table t7(a int, b int, index idx_a(a), index idx_b(b)) partition by hash(a) partitions 4;") + tk.MustExec("create table t8(a int, b int, index idx_a(a), index idx_b(b)) partition by hash(a) partitions 4;") + tk.MustExec("create table t9(a int, b int, index idx_a(a), index idx_b(b)) partition by hash(a) partitions 4;") + tk.MustExec("analyze table t7, t8, t9") + + // Create virtual tiflash replica info. + dom := domain.GetDomain(tk.Session()) + is := dom.InfoSchema() + db, exists := is.SchemaByName(model.NewCIStr("test")) + require.True(t, exists) + for _, tblInfo := range db.Tables { + name := tblInfo.Name.L + if name == "t4" || name == "t5" || name == "t6" { + tblInfo.TiFlashReplica = &model.TiFlashReplicaInfo{ + Count: 1, + Available: true, + } + } + } + + tk.MustExec("create definer='root'@'localhost' view v as select /*+ leading(t1), inl_join(t1) */ t.a from t join t1 join t2 where t.a = t1.a and t1.b = t2.b;") + tk.MustExec("create definer='root'@'localhost' view v1 as select /*+ leading(t2), merge_join(t) */ t.a from t join t1 join t2 where t.a = t1.a and t1.b = t2.b;") + tk.MustExec("create definer='root'@'localhost' view v2 as select t.a from t join t1 join t2 where t.a = t1.a and t1.b = t2.b;") + + var input []string + var output []struct { + SQL string + Plan []string + Warn []string + } + integrationSuiteData := GetIntegrationSuiteData() + integrationSuiteData.LoadTestCases(t, &input, &output) + for i, tt := range input { + testdata.OnRecord(func() { + output[i].SQL = tt + output[i].Plan = testdata.ConvertRowsToStrings(tk.MustQuery(tt).Rows()) + output[i].Warn = testdata.ConvertSQLWarnToStrings(tk.Session().GetSessionVars().StmtCtx.GetWarnings()) + }) + res := tk.MustQuery(tt) + res.Check(testkit.Rows(output[i].Plan...)) + require.Equal(t, output[i].Warn, testdata.ConvertSQLWarnToStrings(tk.Session().GetSessionVars().StmtCtx.GetWarnings())) + } +} + +func TestReadFromStorageHintAndIsolationRead(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("drop table if exists t, tt, ttt") + tk.MustExec("create table t(a int, b int, index ia(a))") + tk.MustExec("set @@session.tidb_isolation_read_engines=\"tikv\"") + + // Create virtual tiflash replica info. + dom := domain.GetDomain(tk.Session()) + is := dom.InfoSchema() + db, exists := is.SchemaByName(model.NewCIStr("test")) + require.True(t, exists) + for _, tblInfo := range db.Tables { + tblInfo.TiFlashReplica = &model.TiFlashReplicaInfo{ + Count: 1, + Available: true, + } + } + + var input []string + var output []struct { + SQL string + Plan []string + Warn []string + } + integrationSuiteData := GetIntegrationSuiteData() + integrationSuiteData.LoadTestCases(t, &input, &output) + for i, tt := range input { + tk.Session().GetSessionVars().StmtCtx.SetWarnings(nil) + testdata.OnRecord(func() { + output[i].SQL = tt + output[i].Plan = testdata.ConvertRowsToStrings(tk.MustQuery(tt).Rows()) + output[i].Warn = testdata.ConvertSQLWarnToStrings(tk.Session().GetSessionVars().StmtCtx.GetWarnings()) + }) + res := tk.MustQuery(tt) + res.Check(testkit.Rows(output[i].Plan...)) + require.Equal(t, output[i].Warn, testdata.ConvertSQLWarnToStrings(tk.Session().GetSessionVars().StmtCtx.GetWarnings())) + } +} + +func TestIsolationReadTiFlashUseIndexHint(t *testing.T) { + store := testkit.CreateMockStore(t) + tk := testkit.NewTestKit(t, store) + + tk.MustExec("use test") + tk.MustExec("drop table if exists t") + tk.MustExec("create table t(a int, index idx(a));") + + // Create virtual tiflash replica info. + dom := domain.GetDomain(tk.Session()) + is := dom.InfoSchema() + db, exists := is.SchemaByName(model.NewCIStr("test")) + require.True(t, exists) + for _, tblInfo := range db.Tables { + tblInfo.TiFlashReplica = &model.TiFlashReplicaInfo{ + Count: 1, + Available: true, + } + } + + tk.MustExec("set @@session.tidb_isolation_read_engines=\"tiflash\"") + var input []string + var output []struct { + SQL string + Plan []string + Warn []string + } + integrationSuiteData := GetIntegrationSuiteData() + integrationSuiteData.LoadTestCases(t, &input, &output) + for i, tt := range input { + testdata.OnRecord(func() { + output[i].SQL = tt + output[i].Plan = testdata.ConvertRowsToStrings(tk.MustQuery(tt).Rows()) + output[i].Warn = testdata.ConvertSQLWarnToStrings(tk.Session().GetSessionVars().StmtCtx.GetWarnings()) + }) + res := tk.MustQuery(tt) + res.Check(testkit.Rows(output[i].Plan...)) + require.Equal(t, output[i].Warn, testdata.ConvertSQLWarnToStrings(tk.Session().GetSessionVars().StmtCtx.GetWarnings())) + } +} + +func TestIndexMergeHint4CNF(t *testing.T) { + store := testkit.CreateMockStore(t) + tk := testkit.NewTestKit(t, store) + + tk.MustExec("use test") + tk.MustExec("drop table if exists t") + tk.MustExec("create table t(id int primary key, a int, b int, c int, key(a), key(b), key(c))") + + var input []string + var output []struct { + SQL string + Plan []string + } + integrationSuiteData := GetIntegrationSuiteData() + integrationSuiteData.LoadTestCases(t, &input, &output) + for i, tt := range input { + testdata.OnRecord(func() { + output[i].SQL = tt + output[i].Plan = testdata.ConvertRowsToStrings(tk.MustQuery(tt).Rows()) + }) + tk.MustQuery(tt).Check(testkit.Rows(output[i].Plan...)) + } +} + +func TestIndexHintWarning(t *testing.T) { + store := testkit.CreateMockStore(t) + tk := testkit.NewTestKit(t, store) + tk.MustExec("use test") + tk.MustExec("drop table if exists t1, t2") + tk.MustExec("create table t1(a int, b int, c int, key a(a), key b(b))") + tk.MustExec("create table t2(a int, b int, c int, key a(a), key b(b))") + var input []string + var output []struct { + SQL string + Warnings []string + } + integrationSuiteData := GetIntegrationSuiteData() + integrationSuiteData.LoadTestCases(t, &input, &output) + for i, tt := range input { + testdata.OnRecord(func() { + output[i].SQL = tt + tk.MustQuery(tt) + warns := tk.Session().GetSessionVars().StmtCtx.GetWarnings() + output[i].Warnings = make([]string, len(warns)) + for j := range warns { + output[i].Warnings[j] = warns[j].Err.Error() + } + }) + tk.MustQuery(tt) + warns := tk.Session().GetSessionVars().StmtCtx.GetWarnings() + require.Len(t, warns, len(output[i].Warnings)) + for j := range warns { + require.Equal(t, stmtctx.WarnLevelWarning, warns[j].Level) + require.EqualError(t, warns[j].Err, output[i].Warnings[j]) + } + } + //Test view with index hint should result error + tk.MustExec("drop table if exists t1") + tk.MustExec("drop view if exists v1") + tk.MustExec("CREATE TABLE t1 (c1 INT PRIMARY KEY, c2 INT, INDEX (c2))") + tk.MustExec("INSERT INTO t1 VALUES (1,1), (2,2), (3,3)") + tk.MustExec("CREATE VIEW v1 AS SELECT c1, c2 FROM t1") + err := tk.ExecToErr("SELECT * FROM v1 USE INDEX (PRIMARY) WHERE c1=2") + require.True(t, terror.ErrorEqual(err, core.ErrKeyDoesNotExist)) +} + +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;") + tk.MustExec("use test") + tk.MustExec("drop table if exists t") + tk.MustExec("create table t(a int primary key, b int, c int, key b(b))") + var input []string + var output []struct { + SQL string + Plan []string + Warnings []string + } + integrationSuiteData := GetIntegrationSuiteData() + integrationSuiteData.LoadTestCases(t, &input, &output) + for i, tt := range input { + testdata.OnRecord(func() { + output[i].SQL = tt + output[i].Plan = testdata.ConvertRowsToStrings(tk.MustQuery(tt).Rows()) + warnings := tk.Session().GetSessionVars().StmtCtx.GetWarnings() + output[i].Warnings = make([]string, len(warnings)) + for j, warning := range warnings { + output[i].Warnings[j] = warning.Err.Error() + } + }) + tk.MustQuery(tt).Check(testkit.Rows(output[i].Plan...)) + warnings := tk.Session().GetSessionVars().StmtCtx.GetWarnings() + require.Len(t, warnings, len(output[i].Warnings)) + for j, warning := range warnings { + require.EqualError(t, warning.Err, output[i].Warnings[j]) + } + } +} + +func TestHintWithoutTableWarning(t *testing.T) { + store := testkit.CreateMockStore(t) + tk := testkit.NewTestKit(t, store) + tk.MustExec("use test") + tk.MustExec("drop table if exists t1, t2") + tk.MustExec("create table t1(a int, b int, c int, key a(a))") + tk.MustExec("create table t2(a int, b int, c int, key a(a))") + var input []string + var output []struct { + SQL string + Warnings []string + } + integrationSuiteData := GetIntegrationSuiteData() + integrationSuiteData.LoadTestCases(t, &input, &output) + for i, tt := range input { + testdata.OnRecord(func() { + output[i].SQL = tt + tk.MustQuery(tt) + warns := tk.Session().GetSessionVars().StmtCtx.GetWarnings() + output[i].Warnings = make([]string, len(warns)) + for j := range warns { + output[i].Warnings[j] = warns[j].Err.Error() + } + }) + tk.MustQuery(tt) + warns := tk.Session().GetSessionVars().StmtCtx.GetWarnings() + require.Len(t, warns, len(output[i].Warnings)) + for j := range warns { + require.Equal(t, stmtctx.WarnLevelWarning, warns[j].Level) + require.EqualError(t, warns[j].Err, output[i].Warnings[j]) + } + } +} + +func TestOptimizeHintOnPartitionTable(t *testing.T) { + store := testkit.CreateMockStore(t) + tk := testkit.NewTestKit(t, store) + + tk.MustExec("use test") + tk.MustExec("drop table if exists t") + tk.MustExec(`create table t ( + a int, b int, c varchar(20), + primary key(a), key(b), key(c) + ) partition by range columns(a) ( + partition p0 values less than(6), + partition p1 values less than(11), + partition p2 values less than(16));`) + tk.MustExec(`insert into t values (1,1,"1"), (2,2,"2"), (8,8,"8"), (11,11,"11"), (15,15,"15")`) + tk.MustExec("set @@tidb_enable_index_merge = off") + defer func() { + tk.MustExec("set @@tidb_enable_index_merge = on") + }() + + // Create virtual tiflash replica info. + dom := domain.GetDomain(tk.Session()) + is := dom.InfoSchema() + db, exists := is.SchemaByName(model.NewCIStr("test")) + require.True(t, exists) + for _, tblInfo := range db.Tables { + if tblInfo.Name.L == "t" { + tblInfo.TiFlashReplica = &model.TiFlashReplicaInfo{ + Count: 1, + Available: true, + } + } + } + + tk.MustExec(`set @@tidb_partition_prune_mode='` + string(variable.Static) + `'`) + + var input []string + var output []struct { + SQL string + Plan []string + Warn []string + } + integrationSuiteData := GetIntegrationSuiteData() + integrationSuiteData.LoadTestCases(t, &input, &output) + for i, tt := range input { + testdata.OnRecord(func() { + output[i].SQL = tt + output[i].Plan = testdata.ConvertRowsToStrings(tk.MustQuery("explain format = 'brief' " + tt).Rows()) + output[i].Warn = testdata.ConvertRowsToStrings(tk.MustQuery("show warnings").Rows()) + }) + tk.MustQuery("explain format = 'brief' " + tt).Check(testkit.Rows(output[i].Plan...)) + tk.MustQuery("show warnings").Check(testkit.Rows(output[i].Warn...)) + } +} + +func TestInvalidHint(t *testing.T) { + store := testkit.CreateMockStore(t) + tk := testkit.NewTestKit(t, store) + + tk.MustExec("use test") + tk.MustExec("drop table if exists tt") + tk.MustExec("create table tt(a int, key(a));") + + var input []string + var output []struct { + SQL string + Plan []string + Warnings []string + } + integrationSuiteData := GetIntegrationSuiteData() + integrationSuiteData.LoadTestCases(t, &input, &output) + warning := "show warnings;" + for i, tt := range input { + testdata.OnRecord(func() { + output[i].SQL = tt + output[i].Plan = testdata.ConvertRowsToStrings(tk.MustQuery(tt).Rows()) + output[i].Warnings = testdata.ConvertRowsToStrings(tk.MustQuery(warning).Rows()) + }) + tk.MustQuery(tt).Check(testkit.Rows(output[i].Plan...)) + } +} diff --git a/planner/core/casetest/hint/main_test.go b/planner/core/casetest/hint/main_test.go new file mode 100644 index 0000000000000..c849fde23f0a9 --- /dev/null +++ b/planner/core/casetest/hint/main_test.go @@ -0,0 +1,54 @@ +// Copyright 2023 PingCAP, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package hint + +import ( + "flag" + "testing" + + "github.com/pingcap/tidb/testkit/testdata" + "github.com/pingcap/tidb/testkit/testmain" + "github.com/pingcap/tidb/testkit/testsetup" + "go.uber.org/goleak" +) + +var testDataMap = make(testdata.BookKeeper) + +func TestMain(m *testing.M) { + testsetup.SetupForCommonTest() + + flag.Parse() + testDataMap.LoadTestSuiteData("testdata", "integration_suite") + + opts := []goleak.Option{ + goleak.IgnoreTopFunction("github.com/golang/glog.(*fileSink).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), + goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), + goleak.IgnoreTopFunction("gopkg.in/natefinch/lumberjack%2ev2.(*Logger).millRun"), + goleak.IgnoreTopFunction("github.com/tikv/client-go/v2/txnkv/transaction.keepAlive"), + goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"), + } + + callback := func(i int) int { + testDataMap.GenerateOutputIfNeeded() + return i + } + + goleak.VerifyTestMain(testmain.WrapTestingM(m, callback), opts...) +} + +func GetIntegrationSuiteData() testdata.TestData { + return testDataMap["integration_suite"] +} diff --git a/planner/core/casetest/hint/testdata/integration_suite_in.json b/planner/core/casetest/hint/testdata/integration_suite_in.json new file mode 100644 index 0000000000000..360fc9afe8377 --- /dev/null +++ b/planner/core/casetest/hint/testdata/integration_suite_in.json @@ -0,0 +1,376 @@ +[ + { + "name": "TestIndexMergeHint4CNF", + "cases": [ + "explain format = 'brief' select * from t where b = 1 and (a = 1 or c = 1)", + "explain format = 'brief' select /*+ USE_INDEX_MERGE(t, a, c) */ * from t where b = 1 and (a = 1 or c = 1)" + ] + }, + { + "name": "TestHintWithRequiredProperty", + "cases": [ + "desc format = 'brief' select /*+ INL_JOIN(t2) */ * from t t1, t t2 where t1.a = t2.b order by t2.a", + "desc format = 'brief' select /*+ INL_HASH_JOIN(t2) */ * from t t1, t t2 where t1.a = t2.b order by t2.a", + "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", + "desc format = 'brief' select * from t t1, (select /*+ HASH_AGG() */ b, max(a) from t t2 group by b) t2 where t1.b = t2.b order by t1.b", + "desc format = 'brief' select /*+ INL_HASH_JOIN(t2) */ distinct t2.a from t t1 join t t2 on t1.a = t2.a", + // This hint cannot work, so choose another plan. + "desc format = 'brief' select /*+ INL_JOIN(t2) */ * from t t1, t t2 where t1.a = t2.c order by t1.a" + ] + }, + { + "name": "TestIndexHintWarning", + "cases": [ + "select /*+ USE_INDEX(t1, j) */ * from t1", + "select /*+ IGNORE_INDEX(t1, j) */ * from t1", + "select /*+ USE_INDEX(t2, a, b, c) */ * from t1", + "select /*+ USE_INDEX(t2) */ * from t1", + "select /*+ USE_INDEX(t1, a), USE_INDEX(t2, a), USE_INDEX(t3, a) */ * from t1, t2 where t1.a=t2.a", + "select /*+ USE_INDEX(t3, a), USE_INDEX(t4, b), IGNORE_INDEX(t3, a) */ * from t1, t2 where t1.a=t2.a", + "select /*+ USE_INDEX_MERGE(t3, a, b, d) */ * from t1", + "select /*+ USE_INDEX_MERGE(t1, a, b, c, d) */ * from t1", + "select /*+ USE_INDEX_MERGE(t1, a, b), USE_INDEX(t1, a) */ * from t1", + "select /*+ USE_INDEX_MERGE(t1, a, b), IGNORE_INDEX(t1, a) */ * from t1", + "select /*+ USE_INDEX_MERGE(t1, primary, a, b, c) */ * from t1" + ] + }, + { + "name": "TestHintWithoutTableWarning", + "cases": [ + "select /*+ TIDB_SMJ() */ * from t1, t2 where t1.a=t2.a", + "select /*+ MERGE_JOIN() */ * from t1, t2 where t1.a=t2.a", + "select /*+ INL_JOIN() */ * from t1, t2 where t1.a=t2.a", + "select /*+ TIDB_INLJ() */ * from t1, t2 where t1.a=t2.a", + "select /*+ INL_HASH_JOIN() */ * from t1, t2 where t1.a=t2.a", + "select /*+ INL_MERGE_JOIN() */ * from t1, t2 where t1.a=t2.a", + "select /*+ HASH_JOIN() */ * from t1, t2 where t1.a=t2.a", + "select /*+ USE_INDEX() */ * from t1, t2 where t1.a=t2.a", + "select /*+ IGNORE_INDEX() */ * from t1, t2 where t1.a=t2.a", + "select /*+ USE_INDEX_MERGE() */ * from t1, t2 where t1.a=t2.a" + ] + }, + { + "name": "TestOptimizeHintOnPartitionTable", + "cases": [ + "select /*+ use_index(t) */ * from t", + "select /*+ use_index(t partition(p0, p1) b, c) */ * from t partition(p1,p2)", + "select /*+ use_index(t partition(p_non_exist)) */ * from t partition(p1,p2)", + "select /*+ use_index(t partition(p0, p1) b, c) */ * from t", + "select /*+ ignore_index(t partition(p0, p1) b, c) */ * from t", + "select /*+ hash_join(t1, t2 partition(p0)) */ * from t t1 join t t2 on t1.a = t2.a", + "select /*+ use_index_merge(t partition(p0)) */ * from t where t.b = 1 or t.c = \"8\"", + "select /*+ use_index_merge(t partition(p0, p1) primary, b) */ * from t where t.a = 1 or t.b = 2", + "select /*+ use_index(t partition(p0) b) */ * from t partition(p0, p1)" + ] + }, + { + "name": "TestInvalidHint", + "cases": [ + "explain format = 'brief' select /*+ use_index_merge(tt) */ * from tt where a=10 or a=20;", + "explain format = 'brief' select /*+ use_index_merge(tt) */ * from tt where a=15 or (a < 10 or a > 20);" + ] + }, + { + "name": "TestReadFromStorageHint", + "cases": [ + "desc format = 'brief' select avg(a) from t", + "desc format = 'brief' select /*+ read_from_storage(tiflash[t]) */ avg(a) from t", + "desc format = 'brief' select /*+ read_from_storage(tiflash[t]) */ sum(a) from t", + "desc format = 'brief' select /*+ read_from_storage(tiflash[t]) */ sum(a+1) from t", + "desc format = 'brief' select /*+ read_from_storage(tiflash[t]) */ sum(isnull(a)) from t", + "desc format = 'brief' select /*+ READ_FROM_STORAGE(TIKV[t1], TIKV[t2]) */ * from t t1, t t2 where t1.a = t2.a", + "desc format = 'brief' select /*+ READ_FROM_STORAGE(TIKV[t1], TIFLASH[t2]) */ * from t t1, t t2 where t1.a = t2.a", + "desc format = 'brief' select * from tt where (tt.a > 1 and tt.a < 20) or (tt.a >= 30 and tt.a < 55)", + "desc format = 'brief' select /*+ read_from_storage(tiflash[tt]) */ * from tt where (tt.a > 1 and tt.a < 20) or (tt.a >= 30 and tt.a < 55)", + "desc format = 'brief' select * from ttt order by ttt.a desc", + "desc format = 'brief' select /*+ read_from_storage(tiflash[ttt]) */ * from ttt order by ttt.a desc", + "desc format = 'brief' select /*+ read_from_storage(tiflash[ttt]) */ * from ttt order by ttt.a", + "desc format = 'brief' select /*+ read_from_storage(tikv[t, ttt]) */ * from ttt", + "desc format = 'brief' select /*+ read_from_storage(tiflash[t, ttt], tikv[tt]) */ * from ttt" + ] + }, + { + "name": "TestKeepOrderHint", + "cases": [ + "explain select /*+ order_index(t1, idx_a) */ * from t1 where a<10 order by a limit 1;", + "explain select /*+ order_index(t, primary) */ * from t where a<10 order by a limit 1;", + "explain select /*+ no_order_index(t1, idx_a) */ * from t1 where a<10 order by a limit 1;", + "explain select /*+ no_order_index(t, primary) */ * from t where a<10 order by a limit 1;", + "explain select /*+ no_order_index(t1, idx_a) */ * from t1 where a<10 limit 1;", + "explain select /*+ no_order_index(t, primary) */ * from t where a<10 limit 1;", + + // The index doesn't exist + "explain select /*+ order_index(t1, idx_b) */ * from t1 where b<10 order by b limit 1;", + "explain select /*+ order_index(t, idx_b) */ * from t where b<10 order by b limit 1;", + "explain select /*+ no_order_index(t1, idx_b) */ * from t1 where b<10 order by b limit 1;", + "explain select /*+ no_order_index(t, idx_b) */ * from t where b<10 order by b limit 1;", + + // Use the order_index/ no_order_index with the use_index/ ignore_index/ force_index hint at the same time + "explain select /*+ order_index(t1, idx_a) use_index(t1, idx_a) */ * from t1 where a<10 order by a limit 1;", + "explain select /*+ order_index(t1, idx_a) */ * from t1 use index(idx_a) where a<10 order by a limit 1;", + "explain select /*+ order_index(t1, idx_a) force_index(t1, idx_a) */ * from t1 where a<10 order by a limit 1;", + "explain select /*+ order_index(t1, idx_a) */ * from t1 force index(idx_a) where a<10 order by a limit 1;", + "explain select /*+ order_index(t1, idx_a) ignore_index(t1, idx_a) */ * from t1 where a<10 order by a limit 1;", + + "explain select /*+ order_index(t, primary) use_index(t, primary) */ * from t where a<10 order by a limit 1;", + "explain select /*+ order_index(t, primary) */ * from t use index(primary) where a<10 order by a limit 1;", + "explain select /*+ order_index(t, primary) force_index(t, primary) */ * from t where a<10 order by a limit 1;", + "explain select /*+ order_index(t, primary) */ * from t force index(primary) where a<10 order by a limit 1;", + "explain select /*+ order_index(t, primary) ignore_index(t, primary) */ * from t where a<10 order by a limit 1;", + + "explain select /*+ no_order_index(t, primary) use_index(t, primary) */ * from t where a<10 order by a limit 1;", + "explain select /*+ no_order_index(t, primary) */ * from t use index(primary) where a<10 order by a limit 1;", + "explain select /*+ no_order_index(t, primary) force_index(t, primary) */ * from t where a<10 order by a limit 1;", + "explain select /*+ no_order_index(t, primary) */ * from t force index(primary) where a<10 order by a limit 1;", + "explain select /*+ no_order_index(t, primary) ignore_index(t, primary) */ * from t where a<10 order by a limit 1;", + + "explain select /*+ no_order_index(t1, idx_a) use_index(t1, idx_a) */ * from t1 where a<10 order by a limit 1;", + "explain select /*+ no_order_index(t1, idx_a) */ * from t1 use index(idx_a) where a<10 order by a limit 1;", + "explain select /*+ no_order_index(t1, idx_a) force_index(t1, idx_a) */ * from t1 where a<10 order by a limit 1;", + "explain select /*+ no_order_index(t1, idx_a) */ * from t1 force index(idx_a) where a<10 order by a limit 1;", + "explain select /*+ no_order_index(t1, idx_a) ignore_index(t1, idx_a) */ * from t1 where a<10 order by a limit 1;", + + // Use the order_index/ no_order_index with the use_view hint at the same time + "explain select /*+ qb_name(qb, v) order_index(t1@qb, idx_a) */ * from v", + "explain select /*+ qb_name(qb, v1) order_index(t@qb, primary) */ * from v1", + "explain select /*+ qb_name(qb, v) no_order_index(t1@qb, idx_a) */ * from v", + "explain select /*+ qb_name(qb, v1) no_order_index(t@qb, primary) */ * from v1", + + // Use the order_index/ no_order_index with CTE at the same time + "explain WITH CTE AS (select /*+ order_index(t1, idx_a) */ * from t1 where a<10 order by a limit 1) SELECT * FROM CTE WHERE CTE.a <18 union select * from cte where cte.b > 1;", + "explain WITH CTE AS (select /*+ order_index(t, primary) */ * from t where a<10 order by a limit 1) SELECT * FROM CTE WHERE CTE.a <18 union select * from cte where cte.b > 1;", + "explain WITH CTE AS (select /*+ no_order_index(t1, idx_a) */ * from t1 where a<10 order by a limit 1) SELECT * FROM CTE WHERE CTE.a <18 union select * from cte where cte.b > 1;", + "explain WITH CTE AS (select /*+ no_order_index(t, primary) */ * from t where a<10 order by a limit 1) SELECT * FROM CTE WHERE CTE.a <18 union select * from cte where cte.b > 1;", + + // Use hint for partition table + "explain select /*+ order_index(th, a) */ a from th where a<1 order by a limit 1", + "explain select /*+ no_order_index(th, a) */ a from th where a<1 order by a limit 1", + "explain select /*+ order_index(thp, primary) */ a from thp where a<1 order by a limit 1", + "explain select /*+ no_order_index(thp, primary) */ a from thp where a<1 order by a limit 1", + "explain select /*+ order_index(thh, a) */ * from thh where a<1 order by a limit 1" + ] + }, + { + "name": "TestViewHint", + "cases": [ + // Hint for view v + "explain format = 'brief' select /*+ qb_name(qb_v_2, v@sel_1 .@sel_2), merge_join(t1@qb_v_2) */ * from v;", + "explain format = 'brief' select /*+ qb_name(qb_v_2, v@sel_1 .@sel_2), merge_join(t1@qb_v_2), stream_agg(@qb_v_2), qb_name(qb_v_1, v@sel_1 .@sel_1), merge_join(t@qb_v_1) */ * from v;", + "explain format = 'brief' select /*+ qb_name(qb_v_2, v1@sel_1 . v@sel_2 .@sel_2), merge_join(t1@qb_v_2) */ * from v1;", + "explain format = 'brief' select /*+ qb_name(qb_v_2, v1@sel_1 . v@sel_2 .@sel_2), merge_join(t1@qb_v_2), stream_agg(@qb_v_2), qb_name(qb_v_1, v1@sel_1 . v@sel_2 .@sel_1), merge_join(t@qb_v_1) */ * from v1;", + "explain format = 'brief' select /*+ qb_name(qb_v_2, v2@sel_1 . v1@sel_2 . v@sel_2 .@sel_2), merge_join(t1@qb_v_2) */ * from v2;", + "explain format = 'brief' select /*+ qb_name(qb_v_2, v2@sel_1 . v1@sel_2 . v@sel_2 .@sel_2), merge_join(t1@qb_v_2), stream_agg(@qb_v_2), qb_name(qb_v_1, v2@sel_1 . v1@sel_2 . v@sel_2 .@sel_1), merge_join(t@qb_v_1) */ * from v2;", + + // Hint for view v1 + "explain format = 'brief' select /*+ qb_name(qb_v1_2, v1@sel_1 .@sel_2), merge_join(t1@qb_v1_2) */ * from v1;", + "explain format = 'brief' select /*+ qb_name(qb_v1_2, v1@sel_1 .@sel_2), merge_join(t1@qb_v1_2), stream_agg(@qb_v1_2), qb_name(qb_v1_1, v1@sel_1 .@sel_1), merge_join(t@qb_v1_1) */ * from v1;", + "explain format = 'brief' select /*+ qb_name(qb_v1_2, v2@sel_1 . v1@sel_2 .@sel_2), merge_join(t1@qb_v1_2) */ * from v2;", + "explain format = 'brief' select /*+ qb_name(qb_v1_2, v2@sel_1 . v1@sel_2 .@sel_2), merge_join(t1@qb_v1_2), stream_agg(@qb_v1_2), qb_name(qb_v1_1, v2@sel_1 . v1@sel_2 .@sel_1), merge_join(t@qb_v1_1) */ * from v2;", + + // Hint for view v2 + "explain format = 'brief' select /*+ qb_name(qb_v2_2, v2@sel_1 .@sel_2), merge_join(t1@qb_v2_2) */ * from v2;", + "explain format = 'brief' select /*+ qb_name(qb_v2_2, v2@sel_1 .@sel_2), merge_join(t1@qb_v2_2), stream_agg(@qb_v2_2), qb_name(qb_v2_1, v2), merge_join(t@qb_v2_1) */ * from v2;" + ] + }, + { + "name": "TestViewHintScope", + "cases": [ + // Same qb name in one query + "explain format = 'brief' select /*+ qb_name(qb_v, v@sel_1 .@sel_2), qb_name(qb_v, v@sel_1 .@sel_1), merge_join(t1@qb_v) */ * from v;", + "explain format = 'brief' select /*+ qb_name(qb_v, v1@sel_1 .v@sel_2 .@sel_2), qb_name(qb_v, v1@sel_1 .v@sel_2 .@sel_1), merge_join(t1@qb_v) */ * from v1;", + "explain format = 'brief' select /*+ qb_name(qb_v, v2@sel_1 .v1@sel_2 .v@sel_2 .@sel_2), qb_name(qb_v, v2@sel_1 .v1@sel_2 .v@sel_2 .@sel_1), merge_join(t1@qb_v) */ * from v2;", + + // Set the unappeared view name + "explain format = 'brief' select /*+ qb_name(qb_v1_2, v@sel_1 .@sel_2), merge_join(t1@qb_v1_2) */ * from v1;", + "explain format = 'brief' select /*+ qb_name(qb_v1_2, v2@sel_1 . v@sel_1 .@sel_2), merge_join(t1@qb_v1_2) */ * from v2;", + + // Exist the view alias + "explain format = 'brief' select /*+ qb_name(qb_v2_2, vv@sel_1 .@sel_2), merge_join(t1@qb_v2_2) */ * from v2 vv;", + "explain format = 'brief' select /*+ qb_name(qb_v2_2, v2@sel_1 .@sel_2), merge_join(t1@qb_v2_2) */ * from v2 vv;", + + // Tht view hint isn't set in the first query block. + "explain format = 'brief' select * from (select /*+ qb_name(qb_v_2, v@sel_1 .@sel_2), merge_join(t1@qb_v_2) */ * from v) t;", + "explain format = 'brief' select * from (select /*+ qb_name(qb_v_2, v.@sel_2), merge_join(t1@qb_v_2), stream_agg(@qb_v_2), qb_name(qb_v_1, v@sel_1 .@sel1), merge_join(t@qb_v_1) */ * from v) t;", + "explain format = 'brief' select * from (select /*+ qb_name(qb_v_2, v1@sel_1 . v@sel_2 .@sel_2), merge_join(t1@qb_v_2) */ * from v1) t;", + "explain format = 'brief' select * from (select /*+ qb_name(qb_v_2, v1.v@sel_2 .@sel_2), merge_join(t1@qb_v_2), stream_agg(@qb_v_2), qb_name(qb_v_1, v1@sel_1 . v@sel_2 .@sel_1), merge_join(t@qb_v_1) */ * from v1) t;", + + "explain format = 'brief' select /*+ qb_name(qb_v_2, v@sel_2 .@sel_2) */ * from (select /*+ merge_join(t1@qb_v_2) */ * from v) t;", + "explain format = 'brief' select /*+ qb_name(qb_v_2, v@sel_2 .@sel_2), qb_name(qb_v_1, v@sel_2 .@sel1) */ * from (select /*+ merge_join(t1@qb_v_2), stream_agg(@qb_v_2), merge_join(t@qb_v_1) */ * from v) t;", + "explain format = 'brief' select /*+ qb_name(qb_v_2, v1@sel_2 . v@sel_2 .@sel_2) */ * from (select /*+ merge_join(t1@qb_v_2) */ * from v1) t;", + "explain format = 'brief' select /*+ qb_name(qb_v_2, v1@sel_2 . v@sel_2 .@sel_2), qb_name(qb_v_1, v1@sel_2 . v@sel_2 .@sel_1) */ * from (select /*+ merge_join(t1@qb_v_2), stream_agg(@qb_v_2), merge_join(t@qb_v_1) */ * from v1) t;", + + // Define more tables in one view hint + "explain format = 'brief' select /*+ qb_name(qb_v1_2, v2. v1@sel_2 .@sel_2), qb_name(qb_v1_1, v2@sel_1 . v1@sel_2 .@sel_1), merge_join(t1@qb_v1_2, t@qb_v1_1), merge_join(t1@qb_v1_2) */ * from v2;", + "explain format = 'brief' select /*+ qb_name(qb_v_2, v2@sel_1 . v1@sel_2 . v@sel_2 .@sel_2), qb_name(qb_v_1, v2@sel_1 . v1@sel_2 . v@sel_2 .@sel_1), merge_join(t1@qb_v_2, t3@qb_v_2) */ * from v2;", + "explain format = 'brief' select /*+ qb_name(qb_v_2, v2@sel_1 . v1@sel_2 . v@sel_2 .@sel_2), qb_name(qb_v_1, v2@sel_1 . v1@sel_2 . v@sel_2 .@sel_1), merge_join(@qb_v_2 t1, t3) */ * from v2;", + + // Ignore the @sel_1 query block + "explain format = 'brief' select /*+ qb_name(qb_v_2, v .@sel_2), merge_join(t1@qb_v_2) */ * from v;", + "explain format = 'brief' select /*+ qb_name(qb_v_1, v@sel_1), merge_join(t@qb_v_1) */ * from v;", + "explain format = 'brief' select /*+ qb_name(qb_v_2, v1 .v@sel_2 .@sel_2), merge_join(t1@qb_v_2) */ * from v1;", + "explain format = 'brief' select /*+ qb_name(qb_v_1, v1 .v@sel_2), merge_join(t@qb_v_1) */ * from v1;", + + // Use the query block before define it + "explain format = 'brief' select /*+ merge_join(t1@qb_v_2), qb_name(qb_v_2, v@sel_1 .@sel_2) */ * from v;", + "explain format = 'brief' select /*+ merge_join(t@qb_v_1), stream_agg(@qb_v_2), qb_name(qb_v_2, v@sel_1 .@sel_2), qb_name(qb_v_1, v@sel_1 .@sel_1) */ * from v;", + + // The view contains the hint when creation + "explain format = 'brief' select /*+ qb_name(qb_v3_2, v3@sel_1 .@sel_2), merge_join(t1@qb_v3_2) */ * from v3;", + "explain format = 'brief' select /*+ qb_name(qb_v3_2, v3@sel_1 .@sel_2), merge_join(t1@qb_v3_2), hash_agg(@qb_v3_2), qb_name(qb_v3_1, v3@sel_1 .@sel_1), hash_join(t@qb_v3_1) */ * from v3;", + + // The view is in the CTE + "explain with d1 as (\n select a from (\n select a from (\n select /*+ qb_name(qb, v4) use_index(t4@qb, idx_a) */ a from v4 where a < 10\n ) as t0 where a < 9\n ) as t1 where a < 8\n), d2 as (select /*+ qb_name(qb2, v4) use_index(t4@qb2, idx_b) */ a from v4 where b < 10)\n\nselect * from (select * from d1) as t0 join (select * from d2) as t1;", + "explain with d1 as (\n select a from (\n select a from (\n select a from v4 where a < 10\n ) as t0 where a < 9\n ) as t1 where a < 8\n), d2 as (select a from v4 where b < 10)\n\nselect /*+ qb_name(qb, v4@sel_4) use_index(t4@qb, idx_a) qb_name(qb2, v4@sel_5) use_index(t4@qb, idx_b) */ * from (select * from d1) as t0 join (select * from d2) as t1;", + "explain with d1 as (\n select a from (\n select a from (\n select /*+ qb_name(qb, v5) use_index(t4@qb, idx_a) */ a from v4 where a < 10\n ) as t0 where a < 9\n ) as t1 where a < 8\n), d2 as (select /*+ qb_name(qb2, v4) use_index(t4@qb2, idx_b) */ a from v4 where b < 10)\n\nselect * from (select * from d1) as t0 join (select * from d2) as t1;" + ] + }, + { + "name": "TestAllViewHintType", + "cases": [ + // leading hint + // join nodes in the same view + "explain format = 'brief' select /*+ qb_name(qb_v1, v1), leading(@qb_v1 v, t2) */ * from v1;", + "explain format = 'brief' select /*+ qb_name(qb_v1, v1), leading(v@qb_v1, t2@qb_v1) */ * from v1;", + "explain format = 'brief' select /*+ qb_name(qb_v1, v1), leading(@qb_v1 t3, t2) */ * from v1;", + "explain format = 'brief' select /*+ qb_name(qb_v1, v1), leading(t3@qb_v1, t2@qb_v1) */ * from v1;", + + // join node across view + "explain format = 'brief' select /*+ qb_name(qb_v1, v1), qb_name(qb_v, v1.v), leading(t2@qb_v1, t@qb_v) */ * from v1;", + + // hash_join hint + "explain format = 'brief' select /*+ qb_name(qb_v1, v1), hash_join(@qb_v1 v, t2) */ * from v1;", + "explain format = 'brief' select /*+ qb_name(qb_v1, v1), hash_join(t2@qb_v1, t3@qb_v1) */ * from v1;", + + // hash join build hint + "explain format = 'brief' select /*+ qb_name(qb_v1, v1), hash_join_build(@qb_v1 v) */ * from v1;", + "explain format = 'brief' select /*+ qb_name(qb_v1, v1), hash_join_build(t2@qb_v1) */ * from v1;", + + // hash join probe hint + "explain format = 'brief' select /*+ qb_name(qb_v1, v1), hash_join_build(@qb_v1 v) */ * from v1;", + "explain format = 'brief' select /*+ qb_name(qb_v1, v1), hash_join_build(t2@qb_v1) */ * from v1;", + + // merge join hint + "explain format = 'brief' select /*+ qb_name(qb_v1, v1), merge_join(@qb_v1 v) */ * from v1;", + "explain format = 'brief' select /*+ qb_name(qb_v1, v1), merge_join(t2@qb_v1) */ * from v1;", + + // index join hint + "explain format = 'brief' select /*+ qb_name(qb_v, v), INL_JOIN(@qb_v t) */ * from v;", + "explain format = 'brief' select /*+ qb_name(qb_v, v), INL_JOIN(t@qb_v) */ * from v;", + + // agg hint + "explain format = 'brief' select /*+ qb_name(qb_v2, v2.@sel_2), hash_agg(@qb_v2) */ * from v2;", + "explain format = 'brief' select /*+ qb_name(qb_v2, v2.@sel_2), stream_agg(@qb_v2) */ * from v2;", + + // index hint + "explain format = 'brief' select /*+ qb_name(qb_v3, v3), use_index(t5@qb_v3, idx_a) */ * from v3;", + "explain format = 'brief' select /*+ qb_name(qb_v3, v3), use_index(@qb_v3 t5, idx_b) */ * from v3;", + "explain format = 'brief' select /*+ qb_name(qb_v3, v3), force_index(t5@qb_v3, idx_a) */ * from v3;", + "explain format = 'brief' select /*+ qb_name(qb_v3, v3), force_index(@qb_v3 t5, idx_b) */ * from v3;", + "explain format = 'brief' select /*+ qb_name(qb_v3, v3), ignore_index(t5@qb_v3, idx_a) */ * from v3;", + "explain format = 'brief' select /*+ qb_name(qb_v3, v3), ignore_index(@qb_v3 t5, idx_b) */ * from v3;", + "explain format = 'brief' select /*+ qb_name(qb_v4, v4), use_index_merge(t5@qb_v4, idx_a, idx_b) */ * from v4;", + "explain format = 'brief' select /*+ qb_name(qb_v4, v4), use_index_merge(@qb_v4 t5, idx_b, idx_a) */ * from v4;", + + // read from storage + "explain format = 'brief' select /*+ qb_name(qb_v, v), READ_FROM_STORAGE(TIFLASH[t@qb_v], TIKV[t1@qb_v]) */ * from v;", + + // subquery hint + "explain format = 'brief' select /*+ qb_name(qb_v5, v5.@sel_2), SEMI_JOIN_REWRITE(@qb_v5) */ * from v5;", + "explain format = 'brief' select /*+ qb_name(qb_v6, v6.@sel_2), NO_DECORRELATE(@qb_v6) */ * from v6;", + + // cte hint + "explain format = 'brief' select /*+ qb_name(qb_v7, v7), merge(@qb_v7) */ * from v7;", + "explain format = 'brief' select /*+ qb_name(qb_v8, v8), merge(@qb_v8) */ * from v8;", + + // agg to cop hint + "explain format = 'brief' select /*+ qb_name(qb_v9, v9), AGG_TO_COP(@qb_v9) */ * from v9;", + "explain format = 'brief' select /*+ qb_name(qb_v10, v10), LIMIT_TO_COP(@qb_v10) */ * from v10;", + + // MPP hint + "explain format = 'brief' select /*+ qb_name(qb, v11) read_from_storage(tiflash[t@qb]), MPP_1PHASE_AGG(@qb) */ * from v11;", + "explain format = 'brief' select /*+ qb_name(qb, v11) read_from_storage(tiflash[t@qb]), MPP_2PHASE_AGG(@qb) */ * from v11;", + "explain format = 'brief' select /*+ qb_name(qb, v12) read_from_storage(tiflash[t1@qb, t@qb]), shuffle_join(t1@qb, t@qb) */ * from v12;", + "explain format = 'brief' select /*+ qb_name(qb, v12) read_from_storage(tiflash[t1@qb, t@qb]), broadcast_join(t1@qb, t@qb) */ * from v12;" + ] + }, + { + "name": "TestJoinHintCompatibility", + "cases": [ + // different join method hints + "explain format = 'brief' select /*+ leading(t3), hash_join(t1) */ * from t1 join t2 join t3 where t1.a = t2.a and t2.b = t3.b;", + "explain format = 'brief' select /*+ leading(t2), hash_join(t2) */ * from t1 join t2 join t3 where t1.a = t2.a and t2.b = t3.b;", + "explain format = 'brief' select /*+ leading(t3), merge_join(t1) */ * from t1 join t2 join t3 where t1.a = t2.a and t2.b = t3.b;", + "explain format = 'brief' select /*+ leading(t2), merge_join(t2) */ * from t1 join t2 join t3 where t1.a = t2.a and t2.b = t3.b;", + "explain format = 'brief' select /*+ leading(t3), inl_join(t1) */ * from t1 join t2 join t3 where t1.a = t2.a and t2.b = t3.b;", + "explain format = 'brief' select /*+ leading(t2), inl_join(t2) */ * from t1 join t2 join t3 where t1.a = t2.a and t2.b = t3.b;", + "explain format = 'brief' select /*+ leading(t3), hash_join_build(t1) */ * from t1 join t2 join t3 where t1.a = t2.a and t2.b = t3.b;", + "explain format = 'brief' select /*+ leading(t2), hash_join_build(t2) */ * from t1 join t2 join t3 where t1.a = t2.a and t2.b = t3.b;", + "explain format = 'brief' select /*+ leading(t3), hash_join_probe(t1) */ * from t1 join t2 join t3 where t1.a = t2.a and t2.b = t3.b;", + "explain format = 'brief' select /*+ leading(t2), hash_join_probe(t2) */ * from t1 join t2 join t3 where t1.a = t2.a and t2.b = t3.b;", + "explain format = 'brief' select /*+ leading(t6), shuffle_join(t4) */ * from t4 join t5 join t6 where t4.a = t5.a and t5.b = t6.b;", + "explain format = 'brief' select /*+ leading(t5), shuffle_join(t5) */ * from t4 join t5 join t6 where t4.a = t5.a and t5.b = t6.b;", + "explain format = 'brief' select /*+ leading(t6), broadcast_join(t4) */ * from t4 join t5 join t6 where t4.a = t5.a and t5.b = t6.b;", + "explain format = 'brief' select /*+ leading(t5), broadcast_join(t5) */ * from t4 join t5 join t6 where t4.a = t5.a and t5.b = t6.b;", + + // different join type + "explain format = 'brief' select /*+ leading(t3), hash_join(t1) */ * from t1 join t2 on t1.a = t2.a left join t3 on t2.b = t3.b;", + "explain format = 'brief' select /*+ leading(t2), hash_join(t2) */ * from t1 join t2 on t1.a = t2.a left join t3 on t2.b = t3.b;", + "explain format = 'brief' select /*+ leading(t3), merge_join(t1) */ * from t1 right join t2 on t1.a = t2.a join t3 on t2.b = t3.b;", + "explain format = 'brief' select /*+ leading(t2), merge_join(t2) */ * from t1 right join t2 on t1.a = t2.a join t3 on t2.b = t3.b;", + "explain format = 'brief' select /*+ leading(t3), inl_join(t1) */ * from t1 join t2 on t1.a = t2.a straight_join t3 on t2.b = t3.b;", + "explain format = 'brief' select /*+ leading(t2), inl_join(t2) */ * from t1 join t2 on t1.a = t2.a straight_join t3 on t2.b = t3.b;", + "explain format = 'brief' select /*+ leading(t3), hash_join_build(t1) */ * from t1 cross join t2 on t1.a = t2.a join t3 on t2.b = t3.b;", + "explain format = 'brief' select /*+ leading(t2), hash_join_probe(t2) */ * from t1 cross join t2 on t1.a = t2.a join t3 on t2.b = t3.b;", + + // view + "explain format = 'brief' select * from v", + "explain format = 'brief' select * from v1", + "explain format = 'brief' select /*+ qb_name(qb, v2), leading(t2@qb), merge_join(t@qb) */ * from v2", + "explain format = 'brief' select /*+ qb_name(qb, v2), leading(t1@qb), inl_join(t1@qb) */ * from v2", + + // CTE + "explain with tt as (select /*+ leading(t3), merge_join(t1) */ t1.a from t1 join t2 join t3 where t1.a = t2.a and t2.b=t3.b) select * from tt t1 join tt t2 on t1.a=t2.a", + "explain with tt as (select /*+ leading(t2), inl_join(t2) */ t1.a from t1 join t2 join t3 where t1.a = t2.a and t2.b=t3.b) select * from tt t1 join tt t2 on t1.a=t2.a", + "explain with tt as (select /*+ merge(), leading(t3), inl_join(t1) */ t1.a from t1 join t2 join t3 where t1.a = t2.a and t2.b=t3.b) select * from tt t1 join tt t2 on t1.a=t2.a", + "explain with tt as (select /*+ leading(t2), merge_join(t2), merge() */ t1.a from t1 join t2 join t3 where t1.a = t2.a and t2.b=t3.b) select * from tt t1 join tt t2 on t1.a=t2.a", + + // Subquery + "explain format = 'brief' SELECT /*+ leading(t2@sel_2), merge_join(t) */ * FROM t join t1 on t.a = t1.a WHERE EXISTS (SELECT 1 FROM t2 WHERE t2.b = t1.b);", + "explain format = 'brief' SELECT /*+ leading(t1), inl_join(t1) */ * FROM t join t1 on t.a = t1.a WHERE EXISTS (SELECT 1 FROM t2 WHERE t2.b = t1.b);", + "explain format = 'brief' SELECT /*+ leading(t2@sel_2), merge_join(t) */ * FROM t join t1 on t.a = t1.a WHERE EXISTS (SELECT /*+ SEMI_JOIN_REWRITE() */ 1 FROM t2 WHERE t2.b = t1.b);", + "explain format = 'brief' SELECT /*+ leading(t1), inl_join(t1) */ * FROM t join t1 on t.a = t1.a WHERE EXISTS (SELECT /*+ SEMI_JOIN_REWRITE() */ 1 FROM t2 WHERE t2.b = t1.b);", + + "explain format = 'brief' select /*+ leading(t2@sel_2) merge_join(t) */ * from t join t1 on t.a = t1.a where t1.a < (select sum(t2.a) from t2 where t2.b = t1.b);", + "explain format = 'brief' select /*+ leading(t1), inl_join(t1) */ * from t join t1 on t.a = t1.a where t1.a < (select sum(t2.a) from t2 where t2.b = t1.b);", + "explain format = 'brief' select /*+leading(t2@sel_2) merge_join(t) */ * from t join t1 on t.a = t1.a where t1.a < (select /*+ NO_DECORRELATE() */ sum(t2.a) from t2 where t2.b = t1.b);", + "explain format = 'brief' select /*+ leading(t1), inl_join(t1) */ * from t join t1 on t.a = t1.a where t1.a < (select /*+ NO_DECORRELATE() */ sum(t2.a) from t2 where t2.b = t1.b);", + + // Partition table + "explain format = 'brief' select /*+ leading(t9), hash_join(t7) */ * from t7 join t8 join t9 where t7.a = t8.a and t8.b = t9.b;", + "explain format = 'brief' select /*+ leading(t8), hash_join(t8) */ * from t7 join t8 join t9 where t7.a = t8.a and t8.b = t9.b;", + + // other hints + "explain format = 'brief' select /*+ read_from_storage(tikv[t4, t6]), leading(t6), hash_join_build(t4) */ * from t4 join t5 join t6 where t4.a = t5.a and t5.b = t6.b;", + "explain format = 'brief' select /*+ read_from_storage(tikv[t5]), leading(t5), hash_join_probe(t5) */ * from t4 join t5 join t6 where t4.a = t5.a and t5.b = t6.b;", + "explain format = 'brief' select /*+ read_from_storage(tiflash[t4, t6]), leading(t6), hash_join_build(t4) */ * from t4 join t5 join t6 where t4.a = t5.a and t5.b = t6.b;", + "explain format = 'brief' select /*+ read_from_storage(tiflash[t5]), leading(t5), hash_join_probe(t5) */ * from t4 join t5 join t6 where t4.a = t5.a and t5.b = t6.b;" + ] + }, + { + "name": "TestReadFromStorageHintAndIsolationRead", + "cases": [ + "desc format = 'brief' select /*+ read_from_storage(tikv[t], tiflash[t]) */ avg(a) from t", + "desc format = 'brief' select /*+ read_from_storage(tikv[t]) */ avg(a) from t", + "desc format = 'brief' select /*+ read_from_storage(tiflash[t]) */ avg(a) from t" + ] + }, + { + "name": "TestIsolationReadTiFlashUseIndexHint", + "cases": [ + "explain format = 'brief' select * from t", + "explain format = 'brief' select * from t use index();", + "explain format = 'brief' select /*+ use_index(t, idx)*/ * from t", + "explain format = 'brief' select /*+ use_index(t)*/ * from t" + ] + } +] diff --git a/planner/core/casetest/hint/testdata/integration_suite_out.json b/planner/core/casetest/hint/testdata/integration_suite_out.json new file mode 100644 index 0000000000000..5bab4452ff26b --- /dev/null +++ b/planner/core/casetest/hint/testdata/integration_suite_out.json @@ -0,0 +1,3991 @@ +[ + { + "Name": "TestIndexMergeHint4CNF", + "Cases": [ + { + "SQL": "explain format = 'brief' select * from t where b = 1 and (a = 1 or c = 1)", + "Plan": [ + "IndexLookUp 0.02 root ", + "├─IndexRangeScan(Build) 10.00 cop[tikv] table:t, index:b(b) range:[1,1], keep order:false, stats:pseudo", + "└─Selection(Probe) 0.02 cop[tikv] or(eq(test.t.a, 1), eq(test.t.c, 1))", + " └─TableRowIDScan 10.00 cop[tikv] table:t keep order:false, stats:pseudo" + ] + }, + { + "SQL": "explain format = 'brief' select /*+ USE_INDEX_MERGE(t, a, c) */ * from t where b = 1 and (a = 1 or c = 1)", + "Plan": [ + "IndexMerge 0.02 root type: union", + "├─IndexRangeScan(Build) 10.00 cop[tikv] table:t, index:a(a) range:[1,1], keep order:false, stats:pseudo", + "├─IndexRangeScan(Build) 10.00 cop[tikv] table:t, index:c(c) range:[1,1], keep order:false, stats:pseudo", + "└─Selection(Probe) 0.02 cop[tikv] eq(test.t.b, 1)", + " └─TableRowIDScan 19.99 cop[tikv] table:t keep order:false, stats:pseudo" + ] + } + ] + }, + { + "Name": "TestHintWithRequiredProperty", + "Cases": [ + { + "SQL": "desc format = 'brief' select /*+ INL_JOIN(t2) */ * from t t1, t t2 where t1.a = t2.b order by t2.a", + "Plan": [ + "Sort 12487.50 root test.t.a", + "└─Projection 12487.50 root test.t.a, test.t.b, test.t.c, test.t.a, test.t.b, test.t.c", + " └─IndexJoin 12487.50 root inner join, inner:IndexLookUp, outer key:test.t.a, inner key:test.t.b, equal cond:eq(test.t.a, test.t.b)", + " ├─TableReader(Build) 10000.00 root data:TableFullScan", + " │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + " └─IndexLookUp(Probe) 12487.50 root ", + " ├─Selection(Build) 12487.50 cop[tikv] not(isnull(test.t.b))", + " │ └─IndexRangeScan 12500.00 cop[tikv] table:t2, index:b(b) range: decided by [eq(test.t.b, test.t.a)], keep order:false, stats:pseudo", + " └─TableRowIDScan(Probe) 12487.50 cop[tikv] table:t2 keep order:false, stats:pseudo" + ], + "Warnings": [] + }, + { + "SQL": "desc format = 'brief' select /*+ INL_HASH_JOIN(t2) */ * from t t1, t t2 where t1.a = t2.b order by t2.a", + "Plan": [ + "Sort 12487.50 root test.t.a", + "└─Projection 12487.50 root test.t.a, test.t.b, test.t.c, test.t.a, test.t.b, test.t.c", + " └─IndexHashJoin 12487.50 root inner join, inner:IndexLookUp, outer key:test.t.a, inner key:test.t.b, equal cond:eq(test.t.a, test.t.b)", + " ├─TableReader(Build) 10000.00 root data:TableFullScan", + " │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + " └─IndexLookUp(Probe) 12487.50 root ", + " ├─Selection(Build) 12487.50 cop[tikv] not(isnull(test.t.b))", + " │ └─IndexRangeScan 12500.00 cop[tikv] table:t2, index:b(b) range: decided by [eq(test.t.b, test.t.a)], keep order:false, stats:pseudo", + " └─TableRowIDScan(Probe) 12487.50 cop[tikv] table:t2 keep order:false, stats:pseudo" + ], + "Warnings": [] + }, + { + "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)]", + "├─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", + " ├─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" + ], + "Warnings": [] + }, + { + "SQL": "desc format = 'brief' select * from t t1, (select /*+ HASH_AGG() */ b, max(a) from t t2 group by b) t2 where t1.b = t2.b order by t1.b", + "Plan": [ + "Sort 9990.00 root test.t.b", + "└─Projection 9990.00 root test.t.a, test.t.b, test.t.c, test.t.b, Column#7", + " └─HashJoin 9990.00 root inner join, equal:[eq(test.t.b, test.t.b)]", + " ├─HashAgg(Build) 7992.00 root group by:test.t.b, funcs:max(Column#10)->Column#7, funcs:firstrow(test.t.b)->test.t.b", + " │ └─IndexReader 7992.00 root index:HashAgg", + " │ └─HashAgg 7992.00 cop[tikv] group by:test.t.b, funcs:max(test.t.a)->Column#10", + " │ └─IndexFullScan 9990.00 cop[tikv] table:t2, index:b(b) keep order:false, stats:pseudo", + " └─TableReader(Probe) 9990.00 root data:Selection", + " └─Selection 9990.00 cop[tikv] not(isnull(test.t.b))", + " └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo" + ], + "Warnings": [] + }, + { + "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)", + "├─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" + ], + "Warnings": [] + }, + { + "SQL": "desc format = 'brief' select /*+ INL_JOIN(t2) */ * from t t1, t t2 where t1.a = t2.c order by t1.a", + "Plan": [ + "Sort 12487.50 root test.t.a", + "└─Projection 12487.50 root test.t.a, test.t.b, test.t.c, test.t.a, test.t.b, test.t.c", + " └─HashJoin 12487.50 root inner join, equal:[eq(test.t.c, test.t.a)]", + " ├─TableReader(Build) 9990.00 root data:Selection", + " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t.c))", + " │ └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo", + " └─TableReader(Probe) 10000.00 root data:TableFullScan", + " └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo" + ], + "Warnings": [ + "[planner:1815]Optimizer Hint /*+ INL_JOIN(t2) */ or /*+ TIDB_INLJ(t2) */ is inapplicable", + "[planner:1815]Optimizer Hint /*+ INL_JOIN(t2) */ or /*+ TIDB_INLJ(t2) */ is inapplicable" + ] + } + ] + }, + { + "Name": "TestIndexHintWarning", + "Cases": [ + { + "SQL": "select /*+ USE_INDEX(t1, j) */ * from t1", + "Warnings": [ + "[planner:1176]Key 'j' doesn't exist in table 't1'" + ] + }, + { + "SQL": "select /*+ IGNORE_INDEX(t1, j) */ * from t1", + "Warnings": [ + "[planner:1176]Key 'j' doesn't exist in table 't1'" + ] + }, + { + "SQL": "select /*+ USE_INDEX(t2, a, b, c) */ * from t1", + "Warnings": [ + "[planner:1815]use_index(test.t2, a, b, c) is inapplicable, check whether the table(test.t2) exists" + ] + }, + { + "SQL": "select /*+ USE_INDEX(t2) */ * from t1", + "Warnings": [ + "[planner:1815]use_index(test.t2) is inapplicable, check whether the table(test.t2) exists" + ] + }, + { + "SQL": "select /*+ USE_INDEX(t1, a), USE_INDEX(t2, a), USE_INDEX(t3, a) */ * from t1, t2 where t1.a=t2.a", + "Warnings": [ + "[planner:1815]use_index(test.t3, a) is inapplicable, check whether the table(test.t3) exists" + ] + }, + { + "SQL": "select /*+ USE_INDEX(t3, a), USE_INDEX(t4, b), IGNORE_INDEX(t3, a) */ * from t1, t2 where t1.a=t2.a", + "Warnings": [ + "[planner:1815]use_index(test.t3, a) is inapplicable, check whether the table(test.t3) exists", + "[planner:1815]use_index(test.t4, b) is inapplicable, check whether the table(test.t4) exists", + "[planner:1815]ignore_index(test.t3, a) is inapplicable, check whether the table(test.t3) exists" + ] + }, + { + "SQL": "select /*+ USE_INDEX_MERGE(t3, a, b, d) */ * from t1", + "Warnings": [ + "[planner:1815]use_index_merge(test.t3, a, b, d) is inapplicable, check whether the table(test.t3) exists" + ] + }, + { + "SQL": "select /*+ USE_INDEX_MERGE(t1, a, b, c, d) */ * from t1", + "Warnings": [ + "[planner:1815]use_index_merge(test.t1, a, b, c, d) is inapplicable, check whether the indexes (c, d) exist, or the indexes are conflicted with use_index/ignore_index/force_index hints." + ] + }, + { + "SQL": "select /*+ USE_INDEX_MERGE(t1, a, b), USE_INDEX(t1, a) */ * from t1", + "Warnings": [ + "[planner:1815]use_index_merge(test.t1, a, b) is inapplicable, check whether the indexes (b) exist, or the indexes are conflicted with use_index/ignore_index/force_index hints." + ] + }, + { + "SQL": "select /*+ USE_INDEX_MERGE(t1, a, b), IGNORE_INDEX(t1, a) */ * from t1", + "Warnings": [ + "[planner:1815]use_index_merge(test.t1, a, b) is inapplicable, check whether the indexes (a) exist, or the indexes are conflicted with use_index/ignore_index/force_index hints." + ] + }, + { + "SQL": "select /*+ USE_INDEX_MERGE(t1, primary, a, b, c) */ * from t1", + "Warnings": [ + "[planner:1815]use_index_merge(test.t1, primary, a, b, c) is inapplicable, check whether the indexes (c) exist, or the indexes are conflicted with use_index/ignore_index/force_index hints." + ] + } + ] + }, + { + "Name": "TestHintWithoutTableWarning", + "Cases": [ + { + "SQL": "select /*+ TIDB_SMJ() */ * from t1, t2 where t1.a=t2.a", + "Warnings": [ + "[planner:1815]Hint TIDB_SMJ() is inapplicable. Please specify the table names in the arguments." + ] + }, + { + "SQL": "select /*+ MERGE_JOIN() */ * from t1, t2 where t1.a=t2.a", + "Warnings": [ + "[planner:1815]Hint MERGE_JOIN() is inapplicable. Please specify the table names in the arguments." + ] + }, + { + "SQL": "select /*+ INL_JOIN() */ * from t1, t2 where t1.a=t2.a", + "Warnings": [ + "[planner:1815]Hint INL_JOIN() is inapplicable. Please specify the table names in the arguments." + ] + }, + { + "SQL": "select /*+ TIDB_INLJ() */ * from t1, t2 where t1.a=t2.a", + "Warnings": [ + "[planner:1815]Hint TIDB_INLJ() is inapplicable. Please specify the table names in the arguments." + ] + }, + { + "SQL": "select /*+ INL_HASH_JOIN() */ * from t1, t2 where t1.a=t2.a", + "Warnings": [ + "[planner:1815]Hint INL_HASH_JOIN() is inapplicable. Please specify the table names in the arguments." + ] + }, + { + "SQL": "select /*+ INL_MERGE_JOIN() */ * from t1, t2 where t1.a=t2.a", + "Warnings": [ + "[planner:1815]Hint INL_MERGE_JOIN() is inapplicable. Please specify the table names in the arguments." + ] + }, + { + "SQL": "select /*+ HASH_JOIN() */ * from t1, t2 where t1.a=t2.a", + "Warnings": [ + "[planner:1815]Hint HASH_JOIN() is inapplicable. Please specify the table names in the arguments." + ] + }, + { + "SQL": "select /*+ USE_INDEX() */ * from t1, t2 where t1.a=t2.a", + "Warnings": [ + "[parser:1064]Optimizer hint syntax error at line 1 column 22 near \") */\" " + ] + }, + { + "SQL": "select /*+ IGNORE_INDEX() */ * from t1, t2 where t1.a=t2.a", + "Warnings": [ + "[parser:1064]Optimizer hint syntax error at line 1 column 25 near \") */\" " + ] + }, + { + "SQL": "select /*+ USE_INDEX_MERGE() */ * from t1, t2 where t1.a=t2.a", + "Warnings": [ + "[parser:1064]Optimizer hint syntax error at line 1 column 28 near \") */\" " + ] + } + ] + }, + { + "Name": "TestOptimizeHintOnPartitionTable", + "Cases": [ + { + "SQL": "select /*+ use_index(t) */ * from t", + "Plan": [ + "PartitionUnion 30000.00 root ", + "├─TableReader 10000.00 root data:TableFullScan", + "│ └─TableFullScan 10000.00 cop[tikv] table:t, partition:p0 keep order:false, stats:pseudo", + "├─TableReader 10000.00 root data:TableFullScan", + "│ └─TableFullScan 10000.00 cop[tikv] table:t, partition:p1 keep order:false, stats:pseudo", + "└─TableReader 10000.00 root data:TableFullScan", + " └─TableFullScan 10000.00 cop[tikv] table:t, partition:p2 keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "select /*+ use_index(t partition(p0, p1) b, c) */ * from t partition(p1,p2)", + "Plan": [ + "PartitionUnion 20000.00 root ", + "├─IndexLookUp 10000.00 root ", + "│ ├─IndexFullScan(Build) 10000.00 cop[tikv] table:t, partition:p1, index:b(b) keep order:false, stats:pseudo", + "│ └─TableRowIDScan(Probe) 10000.00 cop[tikv] table:t, partition:p1 keep order:false, stats:pseudo", + "└─TableReader 10000.00 root MppVersion: 2, data:ExchangeSender", + " └─ExchangeSender 10000.00 mpp[tiflash] ExchangeType: PassThrough", + " └─TableFullScan 10000.00 mpp[tiflash] table:t, partition:p2 keep order:false, stats:pseudo" + ], + "Warn": [ + "Warning 1105 unknown partitions (p0) in optimizer hint /*+ USE_INDEX(t PARTITION(p0, p1) b, c) */" + ] + }, + { + "SQL": "select /*+ use_index(t partition(p_non_exist)) */ * from t partition(p1,p2)", + "Plan": [ + "PartitionUnion 20000.00 root ", + "├─TableReader 10000.00 root MppVersion: 2, data:ExchangeSender", + "│ └─ExchangeSender 10000.00 mpp[tiflash] ExchangeType: PassThrough", + "│ └─TableFullScan 10000.00 mpp[tiflash] table:t, partition:p1 keep order:false, stats:pseudo", + "└─TableReader 10000.00 root MppVersion: 2, data:ExchangeSender", + " └─ExchangeSender 10000.00 mpp[tiflash] ExchangeType: PassThrough", + " └─TableFullScan 10000.00 mpp[tiflash] table:t, partition:p2 keep order:false, stats:pseudo" + ], + "Warn": [ + "Warning 1105 unknown partitions (p_non_exist) in optimizer hint /*+ USE_INDEX(t PARTITION(p_non_exist)) */" + ] + }, + { + "SQL": "select /*+ use_index(t partition(p0, p1) b, c) */ * from t", + "Plan": [ + "PartitionUnion 30000.00 root ", + "├─IndexLookUp 10000.00 root ", + "│ ├─IndexFullScan(Build) 10000.00 cop[tikv] table:t, partition:p0, index:b(b) keep order:false, stats:pseudo", + "│ └─TableRowIDScan(Probe) 10000.00 cop[tikv] table:t, partition:p0 keep order:false, stats:pseudo", + "├─IndexLookUp 10000.00 root ", + "│ ├─IndexFullScan(Build) 10000.00 cop[tikv] table:t, partition:p1, index:b(b) keep order:false, stats:pseudo", + "│ └─TableRowIDScan(Probe) 10000.00 cop[tikv] table:t, partition:p1 keep order:false, stats:pseudo", + "└─TableReader 10000.00 root MppVersion: 2, data:ExchangeSender", + " └─ExchangeSender 10000.00 mpp[tiflash] ExchangeType: PassThrough", + " └─TableFullScan 10000.00 mpp[tiflash] table:t, partition:p2 keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "select /*+ ignore_index(t partition(p0, p1) b, c) */ * from t", + "Plan": [ + "PartitionUnion 30000.00 root ", + "├─TableReader 10000.00 root MppVersion: 2, data:ExchangeSender", + "│ └─ExchangeSender 10000.00 mpp[tiflash] ExchangeType: PassThrough", + "│ └─TableFullScan 10000.00 mpp[tiflash] table:t, partition:p0 keep order:false, stats:pseudo", + "├─TableReader 10000.00 root MppVersion: 2, data:ExchangeSender", + "│ └─ExchangeSender 10000.00 mpp[tiflash] ExchangeType: PassThrough", + "│ └─TableFullScan 10000.00 mpp[tiflash] table:t, partition:p1 keep order:false, stats:pseudo", + "└─TableReader 10000.00 root MppVersion: 2, data:ExchangeSender", + " └─ExchangeSender 10000.00 mpp[tiflash] ExchangeType: PassThrough", + " └─TableFullScan 10000.00 mpp[tiflash] table:t, partition:p2 keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "select /*+ hash_join(t1, t2 partition(p0)) */ * from t t1 join t t2 on t1.a = t2.a", + "Plan": [ + "HashJoin 37500.00 root inner join, equal:[eq(test.t.a, test.t.a)]", + "├─PartitionUnion(Build) 30000.00 root ", + "│ ├─TableReader 10000.00 root MppVersion: 2, data:ExchangeSender", + "│ │ └─ExchangeSender 10000.00 mpp[tiflash] ExchangeType: PassThrough", + "│ │ └─TableFullScan 10000.00 mpp[tiflash] table:t2, partition:p0 keep order:false, stats:pseudo", + "│ ├─TableReader 10000.00 root MppVersion: 2, data:ExchangeSender", + "│ │ └─ExchangeSender 10000.00 mpp[tiflash] ExchangeType: PassThrough", + "│ │ └─TableFullScan 10000.00 mpp[tiflash] table:t2, partition:p1 keep order:false, stats:pseudo", + "│ └─TableReader 10000.00 root MppVersion: 2, data:ExchangeSender", + "│ └─ExchangeSender 10000.00 mpp[tiflash] ExchangeType: PassThrough", + "│ └─TableFullScan 10000.00 mpp[tiflash] table:t2, partition:p2 keep order:false, stats:pseudo", + "└─PartitionUnion(Probe) 30000.00 root ", + " ├─TableReader 10000.00 root MppVersion: 2, data:ExchangeSender", + " │ └─ExchangeSender 10000.00 mpp[tiflash] ExchangeType: PassThrough", + " │ └─TableFullScan 10000.00 mpp[tiflash] table:t1, partition:p0 keep order:false, stats:pseudo", + " ├─TableReader 10000.00 root MppVersion: 2, data:ExchangeSender", + " │ └─ExchangeSender 10000.00 mpp[tiflash] ExchangeType: PassThrough", + " │ └─TableFullScan 10000.00 mpp[tiflash] table:t1, partition:p1 keep order:false, stats:pseudo", + " └─TableReader 10000.00 root MppVersion: 2, data:ExchangeSender", + " └─ExchangeSender 10000.00 mpp[tiflash] ExchangeType: PassThrough", + " └─TableFullScan 10000.00 mpp[tiflash] table:t1, partition:p2 keep order:false, stats:pseudo" + ], + "Warn": [ + "Warning 1105 Optimizer Hint /*+ HASH_JOIN(t1, t2 PARTITION(p0)) */ is inapplicable on specified partitions" + ] + }, + { + "SQL": "select /*+ use_index_merge(t partition(p0)) */ * from t where t.b = 1 or t.c = \"8\"", + "Plan": [ + "PartitionUnion 59.97 root ", + "├─IndexMerge 19.99 root type: union", + "│ ├─IndexRangeScan(Build) 10.00 cop[tikv] table:t, partition:p0, index:b(b) range:[1,1], keep order:false, stats:pseudo", + "│ ├─IndexRangeScan(Build) 10.00 cop[tikv] table:t, partition:p0, index:c(c) range:[\"8\",\"8\"], keep order:false, stats:pseudo", + "│ └─TableRowIDScan(Probe) 19.99 cop[tikv] table:t, partition:p0 keep order:false, stats:pseudo", + "├─TableReader 19.99 root MppVersion: 2, data:ExchangeSender", + "│ └─ExchangeSender 19.99 mpp[tiflash] ExchangeType: PassThrough", + "│ └─TableFullScan 19.99 mpp[tiflash] table:t, partition:p1 pushed down filter:or(eq(test.t.b, 1), eq(test.t.c, \"8\")), keep order:false, stats:pseudo", + "└─TableReader 19.99 root MppVersion: 2, data:ExchangeSender", + " └─ExchangeSender 19.99 mpp[tiflash] ExchangeType: PassThrough", + " └─TableFullScan 19.99 mpp[tiflash] table:t, partition:p2 pushed down filter:or(eq(test.t.b, 1), eq(test.t.c, \"8\")), keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "select /*+ use_index_merge(t partition(p0, p1) primary, b) */ * from t where t.a = 1 or t.b = 2", + "Plan": [ + "PartitionUnion 33.00 root ", + "├─IndexMerge 11.00 root type: union", + "│ ├─TableRangeScan(Build) 1.00 cop[tikv] table:t, partition:p0 range:[1,1], keep order:false, stats:pseudo", + "│ ├─IndexRangeScan(Build) 10.00 cop[tikv] table:t, partition:p0, index:b(b) range:[2,2], keep order:false, stats:pseudo", + "│ └─TableRowIDScan(Probe) 11.00 cop[tikv] table:t, partition:p0 keep order:false, stats:pseudo", + "├─IndexMerge 11.00 root type: union", + "│ ├─TableRangeScan(Build) 1.00 cop[tikv] table:t, partition:p1 range:[1,1], keep order:false, stats:pseudo", + "│ ├─IndexRangeScan(Build) 10.00 cop[tikv] table:t, partition:p1, index:b(b) range:[2,2], keep order:false, stats:pseudo", + "│ └─TableRowIDScan(Probe) 11.00 cop[tikv] table:t, partition:p1 keep order:false, stats:pseudo", + "└─TableReader 11.00 root MppVersion: 2, data:ExchangeSender", + " └─ExchangeSender 11.00 mpp[tiflash] ExchangeType: PassThrough", + " └─TableFullScan 11.00 mpp[tiflash] table:t, partition:p2 pushed down filter:or(eq(test.t.a, 1), eq(test.t.b, 2)), keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "select /*+ use_index(t partition(p0) b) */ * from t partition(p0, p1)", + "Plan": [ + "PartitionUnion 20000.00 root ", + "├─IndexLookUp 10000.00 root ", + "│ ├─IndexFullScan(Build) 10000.00 cop[tikv] table:t, partition:p0, index:b(b) keep order:false, stats:pseudo", + "│ └─TableRowIDScan(Probe) 10000.00 cop[tikv] table:t, partition:p0 keep order:false, stats:pseudo", + "└─TableReader 10000.00 root MppVersion: 2, data:ExchangeSender", + " └─ExchangeSender 10000.00 mpp[tiflash] ExchangeType: PassThrough", + " └─TableFullScan 10000.00 mpp[tiflash] table:t, partition:p1 keep order:false, stats:pseudo" + ], + "Warn": null + } + ] + }, + { + "Name": "TestInvalidHint", + "Cases": [ + { + "SQL": "explain format = 'brief' select /*+ use_index_merge(tt) */ * from tt where a=10 or a=20;", + "Plan": [ + "IndexReader 20.00 root index:IndexRangeScan", + "└─IndexRangeScan 20.00 cop[tikv] table:tt, index:a(a) range:[10,10], [20,20], keep order:false, stats:pseudo" + ], + "Warnings": [ + "Warning 1105 IndexMerge is inapplicable" + ] + }, + { + "SQL": "explain format = 'brief' select /*+ use_index_merge(tt) */ * from tt where a=15 or (a < 10 or a > 20);", + "Plan": [ + "IndexReader 6666.67 root index:IndexRangeScan", + "└─IndexRangeScan 6666.67 cop[tikv] table:tt, index:a(a) range:[-inf,10), [15,15], (20,+inf], keep order:false, stats:pseudo" + ], + "Warnings": [ + "Warning 1105 IndexMerge is inapplicable" + ] + } + ] + }, + { + "Name": "TestReadFromStorageHint", + "Cases": [ + { + "SQL": "desc format = 'brief' select avg(a) from t", + "Plan": [ + "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->Column#9, 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": [ + "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->Column#9, 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]) */ 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", + " └─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" + ], + "Warn": null + }, + { + "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", + " └─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" + ], + "Warn": null + }, + { + "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", + " └─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" + ], + "Warn": null + }, + { + "SQL": "desc format = 'brief' select /*+ READ_FROM_STORAGE(TIKV[t1], TIKV[t2]) */ * from t t1, t t2 where t1.a = t2.a", + "Plan": [ + "HashJoin 12487.50 root inner join, equal:[eq(test.t.a, test.t.a)]", + "├─TableReader(Build) 9990.00 root data:Selection", + "│ └─Selection 9990.00 cop[tikv] not(isnull(test.t.a))", + "│ └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo", + "└─TableReader(Probe) 9990.00 root data:Selection", + " └─Selection 9990.00 cop[tikv] not(isnull(test.t.a))", + " └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "desc format = 'brief' select /*+ READ_FROM_STORAGE(TIKV[t1], TIFLASH[t2]) */ * from t t1, t t2 where t1.a = t2.a", + "Plan": [ + "HashJoin 12487.50 root inner join, equal:[eq(test.t.a, test.t.a)]", + "├─TableReader(Build) 9990.00 root data:Selection", + "│ └─Selection 9990.00 cop[tiflash] not(isnull(test.t.a))", + "│ └─TableFullScan 10000.00 cop[tiflash] table:t2 pushed down filter:empty, keep order:false, stats:pseudo", + "└─TableReader(Probe) 9990.00 root data:Selection", + " └─Selection 9990.00 cop[tikv] not(isnull(test.t.a))", + " └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "desc format = 'brief' select * from tt where (tt.a > 1 and tt.a < 20) or (tt.a >= 30 and tt.a < 55)", + "Plan": [ + "TableReader 44.00 root data:TableRangeScan", + "└─TableRangeScan 44.00 cop[tikv] table:tt range:(1,20), [30,55), keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "desc format = 'brief' select /*+ read_from_storage(tiflash[tt]) */ * from tt where (tt.a > 1 and tt.a < 20) or (tt.a >= 30 and tt.a < 55)", + "Plan": [ + "TableReader 44.00 root data:TableRangeScan", + "└─TableRangeScan 44.00 cop[tiflash] table:tt range:(1,20), [30,55), keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "desc format = 'brief' select * from ttt order by ttt.a desc", + "Plan": [ + "TableReader 10000.00 root data:TableFullScan", + "└─TableFullScan 10000.00 cop[tikv] table:ttt keep order:true, desc, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "desc format = 'brief' select /*+ read_from_storage(tiflash[ttt]) */ * from ttt order by ttt.a desc", + "Plan": [ + "Sort 10000.00 root test.ttt.a:desc", + "└─TableReader 10000.00 root data:TableFullScan", + " └─TableFullScan 10000.00 cop[tiflash] table:ttt keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "desc format = 'brief' select /*+ read_from_storage(tiflash[ttt]) */ * from ttt order by ttt.a", + "Plan": [ + "TableReader 10000.00 root data:TableFullScan", + "└─TableFullScan 10000.00 cop[tiflash] table:ttt keep order:true, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "desc format = 'brief' select /*+ read_from_storage(tikv[t, ttt]) */ * from ttt", + "Plan": [ + "TableReader 10000.00 root data:TableFullScan", + "└─TableFullScan 10000.00 cop[tikv] table:ttt keep order:false, stats:pseudo" + ], + "Warn": [ + "[planner:1815]There are no matching table names for (t) in optimizer hint /*+ READ_FROM_STORAGE(tikv[t, ttt]) */. Maybe you can use the table alias name" + ] + }, + { + "SQL": "desc format = 'brief' select /*+ read_from_storage(tiflash[t, ttt], tikv[tt]) */ * from ttt", + "Plan": [ + "TableReader 10000.00 root data:TableFullScan", + "└─TableFullScan 10000.00 cop[tiflash] table:ttt keep order:false, stats:pseudo" + ], + "Warn": [ + "[planner:1815]There are no matching table names for (t, tt) in optimizer hint /*+ READ_FROM_STORAGE(tiflash[t, ttt], tikv[tt]) */. Maybe you can use the table alias name" + ] + } + ] + }, + { + "Name": "TestKeepOrderHint", + "Cases": [ + { + "SQL": "explain select /*+ order_index(t1, idx_a) */ * from t1 where a<10 order by a limit 1;", + "Plan": [ + "Projection_17 1.00 root test.t1.a, test.t1.b", + "└─IndexLookUp_16 1.00 root limit embedded(offset:0, count:1)", + " ├─Limit_15(Build) 1.00 cop[tikv] offset:0, count:1", + " │ └─IndexRangeScan_13 1.00 cop[tikv] table:t1, index:idx_a(a) range:[-inf,10), keep order:true, stats:pseudo", + " └─TableRowIDScan_14(Probe) 1.00 cop[tikv] table:t1 keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain select /*+ order_index(t, primary) */ * from t where a<10 order by a limit 1;", + "Plan": [ + "Limit_11 1.00 root offset:0, count:1", + "└─TableReader_15 1.00 root data:Limit_14", + " └─Limit_14 1.00 cop[tikv] offset:0, count:1", + " └─TableRangeScan_13 333.33 cop[tikv] table:t range:[-inf,10), keep order:true, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain select /*+ no_order_index(t1, idx_a) */ * from t1 where a<10 order by a limit 1;", + "Plan": [ + "TopN_9 1.00 root test.t1.a, offset:0, count:1", + "└─IndexLookUp_16 1.00 root ", + " ├─TopN_15(Build) 1.00 cop[tikv] test.t1.a, offset:0, count:1", + " │ └─IndexRangeScan_13 3323.33 cop[tikv] table:t1, index:idx_a(a) range:[-inf,10), keep order:false, stats:pseudo", + " └─TableRowIDScan_14(Probe) 1.00 cop[tikv] table:t1 keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain select /*+ no_order_index(t, primary) */ * from t where a<10 order by a limit 1;", + "Plan": [ + "TopN_8 1.00 root test.t.a, offset:0, count:1", + "└─TableReader_15 1.00 root data:TopN_14", + " └─TopN_14 1.00 cop[tikv] test.t.a, offset:0, count:1", + " └─TableRangeScan_13 3333.33 cop[tikv] table:t range:[-inf,10), keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain select /*+ no_order_index(t1, idx_a) */ * from t1 where a<10 limit 1;", + "Plan": [ + "IndexLookUp_13 1.00 root limit embedded(offset:0, count:1)", + "├─Limit_12(Build) 1.00 cop[tikv] offset:0, count:1", + "│ └─IndexRangeScan_10 1.00 cop[tikv] table:t1, index:idx_a(a) range:[-inf,10), keep order:false, stats:pseudo", + "└─TableRowIDScan_11(Probe) 1.00 cop[tikv] table:t1 keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain select /*+ no_order_index(t, primary) */ * from t where a<10 limit 1;", + "Plan": [ + "Limit_8 1.00 root offset:0, count:1", + "└─TableReader_12 1.00 root data:Limit_11", + " └─Limit_11 1.00 cop[tikv] offset:0, count:1", + " └─TableRangeScan_10 333.33 cop[tikv] table:t range:[-inf,10), keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain select /*+ order_index(t1, idx_b) */ * from t1 where b<10 order by b limit 1;", + "Plan": [ + "TopN_8 1.00 root test.t1.b, offset:0, count:1", + "└─TableReader_16 1.00 root data:TopN_15", + " └─TopN_15 1.00 cop[tikv] test.t1.b, offset:0, count:1", + " └─Selection_14 3323.33 cop[tikv] lt(test.t1.b, 10)", + " └─TableFullScan_13 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo" + ], + "Warn": [ + "[planner:1176]Key 'idx_b' doesn't exist in table 't1'" + ] + }, + { + "SQL": "explain select /*+ order_index(t, idx_b) */ * from t where b<10 order by b limit 1;", + "Plan": [ + "TopN_8 1.00 root test.t.b, offset:0, count:1", + "└─TableReader_16 1.00 root data:TopN_15", + " └─TopN_15 1.00 cop[tikv] test.t.b, offset:0, count:1", + " └─Selection_14 3323.33 cop[tikv] lt(test.t.b, 10)", + " └─TableFullScan_13 10000.00 cop[tikv] table:t keep order:false, stats:pseudo" + ], + "Warn": [ + "[planner:1176]Key 'idx_b' doesn't exist in table 't'" + ] + }, + { + "SQL": "explain select /*+ no_order_index(t1, idx_b) */ * from t1 where b<10 order by b limit 1;", + "Plan": [ + "TopN_8 1.00 root test.t1.b, offset:0, count:1", + "└─TableReader_16 1.00 root data:TopN_15", + " └─TopN_15 1.00 cop[tikv] test.t1.b, offset:0, count:1", + " └─Selection_14 3323.33 cop[tikv] lt(test.t1.b, 10)", + " └─TableFullScan_13 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo" + ], + "Warn": [ + "[planner:1176]Key 'idx_b' doesn't exist in table 't1'" + ] + }, + { + "SQL": "explain select /*+ no_order_index(t, idx_b) */ * from t where b<10 order by b limit 1;", + "Plan": [ + "TopN_8 1.00 root test.t.b, offset:0, count:1", + "└─TableReader_16 1.00 root data:TopN_15", + " └─TopN_15 1.00 cop[tikv] test.t.b, offset:0, count:1", + " └─Selection_14 3323.33 cop[tikv] lt(test.t.b, 10)", + " └─TableFullScan_13 10000.00 cop[tikv] table:t keep order:false, stats:pseudo" + ], + "Warn": [ + "[planner:1176]Key 'idx_b' doesn't exist in table 't'" + ] + }, + { + "SQL": "explain select /*+ order_index(t1, idx_a) use_index(t1, idx_a) */ * from t1 where a<10 order by a limit 1;", + "Plan": [ + "Projection_19 1.00 root test.t1.a, test.t1.b", + "└─IndexLookUp_18 1.00 root limit embedded(offset:0, count:1)", + " ├─Limit_17(Build) 1.00 cop[tikv] offset:0, count:1", + " │ └─IndexRangeScan_13 1.00 cop[tikv] table:t1, index:idx_a(a) range:[-inf,10), keep order:true, stats:pseudo", + " └─TableRowIDScan_14(Probe) 1.00 cop[tikv] table:t1 keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain select /*+ order_index(t1, idx_a) */ * from t1 use index(idx_a) where a<10 order by a limit 1;", + "Plan": [ + "Projection_19 1.00 root test.t1.a, test.t1.b", + "└─IndexLookUp_18 1.00 root limit embedded(offset:0, count:1)", + " ├─Limit_17(Build) 1.00 cop[tikv] offset:0, count:1", + " │ └─IndexRangeScan_13 1.00 cop[tikv] table:t1, index:idx_a(a) range:[-inf,10), keep order:true, stats:pseudo", + " └─TableRowIDScan_14(Probe) 1.00 cop[tikv] table:t1 keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain select /*+ order_index(t1, idx_a) force_index(t1, idx_a) */ * from t1 where a<10 order by a limit 1;", + "Plan": [ + "Projection_19 1.00 root test.t1.a, test.t1.b", + "└─IndexLookUp_18 1.00 root limit embedded(offset:0, count:1)", + " ├─Limit_17(Build) 1.00 cop[tikv] offset:0, count:1", + " │ └─IndexRangeScan_13 1.00 cop[tikv] table:t1, index:idx_a(a) range:[-inf,10), keep order:true, stats:pseudo", + " └─TableRowIDScan_14(Probe) 1.00 cop[tikv] table:t1 keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain select /*+ order_index(t1, idx_a) */ * from t1 force index(idx_a) where a<10 order by a limit 1;", + "Plan": [ + "Projection_19 1.00 root test.t1.a, test.t1.b", + "└─IndexLookUp_18 1.00 root limit embedded(offset:0, count:1)", + " ├─Limit_17(Build) 1.00 cop[tikv] offset:0, count:1", + " │ └─IndexRangeScan_13 1.00 cop[tikv] table:t1, index:idx_a(a) range:[-inf,10), keep order:true, stats:pseudo", + " └─TableRowIDScan_14(Probe) 1.00 cop[tikv] table:t1 keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain select /*+ order_index(t1, idx_a) ignore_index(t1, idx_a) */ * from t1 where a<10 order by a limit 1;", + "Plan": [ + "TopN_8 1.00 root test.t1.a, offset:0, count:1", + "└─TableReader_16 1.00 root data:TopN_15", + " └─TopN_15 1.00 cop[tikv] test.t1.a, offset:0, count:1", + " └─Selection_14 3323.33 cop[tikv] lt(test.t1.a, 10)", + " └─TableFullScan_13 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain select /*+ order_index(t, primary) use_index(t, primary) */ * from t where a<10 order by a limit 1;", + "Plan": [ + "Limit_11 1.00 root offset:0, count:1", + "└─TableReader_16 1.00 root data:Limit_15", + " └─Limit_15 1.00 cop[tikv] offset:0, count:1", + " └─TableRangeScan_13 333.33 cop[tikv] table:t range:[-inf,10), keep order:true, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain select /*+ order_index(t, primary) */ * from t use index(primary) where a<10 order by a limit 1;", + "Plan": [ + "Limit_11 1.00 root offset:0, count:1", + "└─TableReader_16 1.00 root data:Limit_15", + " └─Limit_15 1.00 cop[tikv] offset:0, count:1", + " └─TableRangeScan_13 333.33 cop[tikv] table:t range:[-inf,10), keep order:true, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain select /*+ order_index(t, primary) force_index(t, primary) */ * from t where a<10 order by a limit 1;", + "Plan": [ + "Limit_11 1.00 root offset:0, count:1", + "└─TableReader_16 1.00 root data:Limit_15", + " └─Limit_15 1.00 cop[tikv] offset:0, count:1", + " └─TableRangeScan_13 333.33 cop[tikv] table:t range:[-inf,10), keep order:true, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain select /*+ order_index(t, primary) */ * from t force index(primary) where a<10 order by a limit 1;", + "Plan": [ + "Limit_11 1.00 root offset:0, count:1", + "└─TableReader_16 1.00 root data:Limit_15", + " └─Limit_15 1.00 cop[tikv] offset:0, count:1", + " └─TableRangeScan_13 333.33 cop[tikv] table:t range:[-inf,10), keep order:true, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain select /*+ order_index(t, primary) ignore_index(t, primary) */ * from t where a<10 order by a limit 1;", + "Plan": [ + "Limit_11 1.00 root offset:0, count:1", + "└─TableReader_15 1.00 root data:Limit_14", + " └─Limit_14 1.00 cop[tikv] offset:0, count:1", + " └─TableRangeScan_13 333.33 cop[tikv] table:t range:[-inf,10), keep order:true, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain select /*+ no_order_index(t, primary) use_index(t, primary) */ * from t where a<10 order by a limit 1;", + "Plan": [ + "TopN_8 1.00 root test.t.a, offset:0, count:1", + "└─TableReader_16 1.00 root data:TopN_15", + " └─TopN_15 1.00 cop[tikv] test.t.a, offset:0, count:1", + " └─TableRangeScan_13 3333.33 cop[tikv] table:t range:[-inf,10), keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain select /*+ no_order_index(t, primary) */ * from t use index(primary) where a<10 order by a limit 1;", + "Plan": [ + "TopN_8 1.00 root test.t.a, offset:0, count:1", + "└─TableReader_16 1.00 root data:TopN_15", + " └─TopN_15 1.00 cop[tikv] test.t.a, offset:0, count:1", + " └─TableRangeScan_13 3333.33 cop[tikv] table:t range:[-inf,10), keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain select /*+ no_order_index(t, primary) force_index(t, primary) */ * from t where a<10 order by a limit 1;", + "Plan": [ + "TopN_8 1.00 root test.t.a, offset:0, count:1", + "└─TableReader_16 1.00 root data:TopN_15", + " └─TopN_15 1.00 cop[tikv] test.t.a, offset:0, count:1", + " └─TableRangeScan_13 3333.33 cop[tikv] table:t range:[-inf,10), keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain select /*+ no_order_index(t, primary) */ * from t force index(primary) where a<10 order by a limit 1;", + "Plan": [ + "TopN_8 1.00 root test.t.a, offset:0, count:1", + "└─TableReader_16 1.00 root data:TopN_15", + " └─TopN_15 1.00 cop[tikv] test.t.a, offset:0, count:1", + " └─TableRangeScan_13 3333.33 cop[tikv] table:t range:[-inf,10), keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain select /*+ no_order_index(t, primary) ignore_index(t, primary) */ * from t where a<10 order by a limit 1;", + "Plan": [ + "TopN_8 1.00 root test.t.a, offset:0, count:1", + "└─TableReader_15 1.00 root data:TopN_14", + " └─TopN_14 1.00 cop[tikv] test.t.a, offset:0, count:1", + " └─TableRangeScan_13 3333.33 cop[tikv] table:t range:[-inf,10), keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain select /*+ no_order_index(t1, idx_a) use_index(t1, idx_a) */ * from t1 where a<10 order by a limit 1;", + "Plan": [ + "TopN_9 1.00 root test.t1.a, offset:0, count:1", + "└─IndexLookUp_18 1.00 root ", + " ├─TopN_17(Build) 1.00 cop[tikv] test.t1.a, offset:0, count:1", + " │ └─IndexRangeScan_13 3323.33 cop[tikv] table:t1, index:idx_a(a) range:[-inf,10), keep order:false, stats:pseudo", + " └─TableRowIDScan_14(Probe) 1.00 cop[tikv] table:t1 keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain select /*+ no_order_index(t1, idx_a) */ * from t1 use index(idx_a) where a<10 order by a limit 1;", + "Plan": [ + "TopN_9 1.00 root test.t1.a, offset:0, count:1", + "└─IndexLookUp_18 1.00 root ", + " ├─TopN_17(Build) 1.00 cop[tikv] test.t1.a, offset:0, count:1", + " │ └─IndexRangeScan_13 3323.33 cop[tikv] table:t1, index:idx_a(a) range:[-inf,10), keep order:false, stats:pseudo", + " └─TableRowIDScan_14(Probe) 1.00 cop[tikv] table:t1 keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain select /*+ no_order_index(t1, idx_a) force_index(t1, idx_a) */ * from t1 where a<10 order by a limit 1;", + "Plan": [ + "TopN_9 1.00 root test.t1.a, offset:0, count:1", + "└─IndexLookUp_18 1.00 root ", + " ├─TopN_17(Build) 1.00 cop[tikv] test.t1.a, offset:0, count:1", + " │ └─IndexRangeScan_13 3323.33 cop[tikv] table:t1, index:idx_a(a) range:[-inf,10), keep order:false, stats:pseudo", + " └─TableRowIDScan_14(Probe) 1.00 cop[tikv] table:t1 keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain select /*+ no_order_index(t1, idx_a) */ * from t1 force index(idx_a) where a<10 order by a limit 1;", + "Plan": [ + "TopN_9 1.00 root test.t1.a, offset:0, count:1", + "└─IndexLookUp_18 1.00 root ", + " ├─TopN_17(Build) 1.00 cop[tikv] test.t1.a, offset:0, count:1", + " │ └─IndexRangeScan_13 3323.33 cop[tikv] table:t1, index:idx_a(a) range:[-inf,10), keep order:false, stats:pseudo", + " └─TableRowIDScan_14(Probe) 1.00 cop[tikv] table:t1 keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain select /*+ no_order_index(t1, idx_a) ignore_index(t1, idx_a) */ * from t1 where a<10 order by a limit 1;", + "Plan": [ + "TopN_8 1.00 root test.t1.a, offset:0, count:1", + "└─TableReader_16 1.00 root data:TopN_15", + " └─TopN_15 1.00 cop[tikv] test.t1.a, offset:0, count:1", + " └─Selection_14 3323.33 cop[tikv] lt(test.t1.a, 10)", + " └─TableFullScan_13 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain select /*+ qb_name(qb, v) order_index(t1@qb, idx_a) */ * from v", + "Plan": [ + "Projection_19 1.00 root test.t1.a, test.t1.b", + "└─IndexLookUp_18 1.00 root limit embedded(offset:0, count:1)", + " ├─Limit_17(Build) 1.00 cop[tikv] offset:0, count:1", + " │ └─IndexRangeScan_15 1.00 cop[tikv] table:t1, index:idx_a(a) range:[-inf,10), keep order:true, stats:pseudo", + " └─TableRowIDScan_16(Probe) 1.00 cop[tikv] table:t1 keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain select /*+ qb_name(qb, v1) order_index(t@qb, primary) */ * from v1", + "Plan": [ + "Limit_13 1.00 root offset:0, count:1", + "└─TableReader_17 1.00 root data:Limit_16", + " └─Limit_16 1.00 cop[tikv] offset:0, count:1", + " └─TableRangeScan_15 333.33 cop[tikv] table:t range:[-inf,10), keep order:true, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain select /*+ qb_name(qb, v) no_order_index(t1@qb, idx_a) */ * from v", + "Plan": [ + "TopN_11 1.00 root test.t1.a, offset:0, count:1", + "└─IndexLookUp_18 1.00 root ", + " ├─TopN_17(Build) 1.00 cop[tikv] test.t1.a, offset:0, count:1", + " │ └─IndexRangeScan_15 3323.33 cop[tikv] table:t1, index:idx_a(a) range:[-inf,10), keep order:false, stats:pseudo", + " └─TableRowIDScan_16(Probe) 1.00 cop[tikv] table:t1 keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain select /*+ qb_name(qb, v1) no_order_index(t@qb, primary) */ * from v1", + "Plan": [ + "TopN_10 1.00 root test.t.a, offset:0, count:1", + "└─TableReader_17 1.00 root data:TopN_16", + " └─TopN_16 1.00 cop[tikv] test.t.a, offset:0, count:1", + " └─TableRangeScan_15 3333.33 cop[tikv] table:t range:[-inf,10), keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain WITH CTE AS (select /*+ order_index(t1, idx_a) */ * from t1 where a<10 order by a limit 1) SELECT * FROM CTE WHERE CTE.a <18 union select * from cte where cte.b > 1;", + "Plan": [ + "HashAgg_31 2.00 root group by:Column#8, Column#9, funcs:firstrow(Column#8)->Column#8, funcs:firstrow(Column#9)->Column#9", + "└─Union_32 1.28 root ", + " ├─Selection_34 0.64 root lt(test.t1.a, 18)", + " │ └─CTEFullScan_35 0.80 root CTE:cte data:CTE_0", + " └─Selection_37 0.64 root gt(test.t1.b, 1)", + " └─CTEFullScan_38 0.80 root CTE:cte data:CTE_0", + "CTE_0 0.80 root Non-Recursive CTE", + "└─Selection_18(Seed Part) 0.80 root or(lt(test.t1.a, 18), gt(test.t1.b, 1))", + " └─Projection_29 1.00 root test.t1.a, test.t1.b", + " └─IndexLookUp_28 1.00 root limit embedded(offset:0, count:1)", + " ├─Limit_27(Build) 1.00 cop[tikv] offset:0, count:1", + " │ └─IndexRangeScan_25 1.00 cop[tikv] table:t1, index:idx_a(a) range:[-inf,10), keep order:true, stats:pseudo", + " └─TableRowIDScan_26(Probe) 1.00 cop[tikv] table:t1 keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain WITH CTE AS (select /*+ order_index(t, primary) */ * from t where a<10 order by a limit 1) SELECT * FROM CTE WHERE CTE.a <18 union select * from cte where cte.b > 1;", + "Plan": [ + "HashAgg_28 2.00 root group by:Column#7, Column#8, funcs:firstrow(Column#7)->Column#7, funcs:firstrow(Column#8)->Column#8", + "└─Union_29 1.28 root ", + " ├─Selection_31 0.64 root lt(test.t.a, 18)", + " │ └─CTEFullScan_32 0.80 root CTE:cte data:CTE_0", + " └─Selection_34 0.64 root gt(test.t.b, 1)", + " └─CTEFullScan_35 0.80 root CTE:cte data:CTE_0", + "CTE_0 0.80 root Non-Recursive CTE", + "└─Selection_18(Seed Part) 0.80 root or(lt(test.t.a, 18), gt(test.t.b, 1))", + " └─Limit_23 1.00 root offset:0, count:1", + " └─TableReader_27 1.00 root data:Limit_26", + " └─Limit_26 1.00 cop[tikv] offset:0, count:1", + " └─TableRangeScan_25 333.33 cop[tikv] table:t range:[-inf,10), keep order:true, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain WITH CTE AS (select /*+ no_order_index(t1, idx_a) */ * from t1 where a<10 order by a limit 1) SELECT * FROM CTE WHERE CTE.a <18 union select * from cte where cte.b > 1;", + "Plan": [ + "HashAgg_29 2.00 root group by:Column#8, Column#9, funcs:firstrow(Column#8)->Column#8, funcs:firstrow(Column#9)->Column#9", + "└─Union_30 1.28 root ", + " ├─Selection_32 0.64 root lt(test.t1.a, 18)", + " │ └─CTEFullScan_33 0.80 root CTE:cte data:CTE_0", + " └─Selection_35 0.64 root gt(test.t1.b, 1)", + " └─CTEFullScan_36 0.80 root CTE:cte data:CTE_0", + "CTE_0 0.80 root Non-Recursive CTE", + "└─Selection_18(Seed Part) 0.80 root or(lt(test.t1.a, 18), gt(test.t1.b, 1))", + " └─TopN_21 1.00 root test.t1.a, offset:0, count:1", + " └─IndexLookUp_28 1.00 root ", + " ├─TopN_27(Build) 1.00 cop[tikv] test.t1.a, offset:0, count:1", + " │ └─IndexRangeScan_25 3323.33 cop[tikv] table:t1, index:idx_a(a) range:[-inf,10), keep order:false, stats:pseudo", + " └─TableRowIDScan_26(Probe) 1.00 cop[tikv] table:t1 keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain WITH CTE AS (select /*+ no_order_index(t, primary) */ * from t where a<10 order by a limit 1) SELECT * FROM CTE WHERE CTE.a <18 union select * from cte where cte.b > 1;", + "Plan": [ + "HashAgg_28 2.00 root group by:Column#7, Column#8, funcs:firstrow(Column#7)->Column#7, funcs:firstrow(Column#8)->Column#8", + "└─Union_29 1.28 root ", + " ├─Selection_31 0.64 root lt(test.t.a, 18)", + " │ └─CTEFullScan_32 0.80 root CTE:cte data:CTE_0", + " └─Selection_34 0.64 root gt(test.t.b, 1)", + " └─CTEFullScan_35 0.80 root CTE:cte data:CTE_0", + "CTE_0 0.80 root Non-Recursive CTE", + "└─Selection_18(Seed Part) 0.80 root or(lt(test.t.a, 18), gt(test.t.b, 1))", + " └─TopN_20 1.00 root test.t.a, offset:0, count:1", + " └─TableReader_27 1.00 root data:TopN_26", + " └─TopN_26 1.00 cop[tikv] test.t.a, offset:0, count:1", + " └─TableRangeScan_25 3333.33 cop[tikv] table:t range:[-inf,10), keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain select /*+ order_index(th, a) */ a from th where a<1 order by a limit 1", + "Plan": [ + "Limit_11 1.00 root offset:0, count:1", + "└─IndexReader_15 1.00 root partition:all index:Limit_14", + " └─Limit_14 1.00 cop[tikv] offset:0, count:1", + " └─IndexRangeScan_13 1.00 cop[tikv] table:th, index:a(a) range:[-inf,1), keep order:true, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain select /*+ no_order_index(th, a) */ a from th where a<1 order by a limit 1", + "Plan": [ + "TopN_8 1.00 root test.th.a, offset:0, count:1", + "└─IndexReader_15 1.00 root partition:all index:TopN_14", + " └─TopN_14 1.00 cop[tikv] test.th.a, offset:0, count:1", + " └─IndexRangeScan_13 3323.33 cop[tikv] table:th, index:a(a) range:[-inf,1), keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain select /*+ order_index(thp, primary) */ a from thp where a<1 order by a limit 1", + "Plan": [ + "Limit_11 1.00 root offset:0, count:1", + "└─TableReader_15 1.00 root partition:all data:Limit_14", + " └─Limit_14 1.00 cop[tikv] offset:0, count:1", + " └─TableRangeScan_13 3333.33 cop[tikv] table:thp range:[-inf,1), keep order:true, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain select /*+ no_order_index(thp, primary) */ a from thp where a<1 order by a limit 1", + "Plan": [ + "TopN_8 1.00 root test.thp.a, offset:0, count:1", + "└─TableReader_15 1.00 root partition:all data:TopN_14", + " └─TopN_14 1.00 cop[tikv] test.thp.a, offset:0, count:1", + " └─TableRangeScan_13 3333.33 cop[tikv] table:thp range:[-inf,1), keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain select /*+ order_index(thh, a) */ * from thh where a<1 order by a limit 1", + "Plan": [ + "Projection_17 1.00 root test.thh.a, test.thh.b", + "└─IndexLookUp_16 1.00 root partition:all limit embedded(offset:0, count:1)", + " ├─Limit_15(Build) 1.00 cop[tikv] offset:0, count:1", + " │ └─IndexRangeScan_13 1.00 cop[tikv] table:thh, index:a(a) range:[-inf,1), keep order:true, stats:pseudo", + " └─TableRowIDScan_14(Probe) 1.00 cop[tikv] table:thh keep order:false, stats:pseudo" + ], + "Warn": null + } + ] + }, + { + "Name": "TestViewHint", + "Cases": [ + { + "SQL": "explain format = 'brief' select /*+ qb_name(qb_v_2, v@sel_1 .@sel_2), merge_join(t1@qb_v_2) */ * from v;", + "Plan": [ + "HashJoin 9990.00 root inner join, equal:[eq(test.t.a, Column#10)]", + "├─HashAgg(Build) 7992.00 root group by:test.t2.a, funcs:count(1)->Column#10", + "│ └─MergeJoin 12487.50 root inner join, left key:test.t1.b, right key:test.t2.b", + "│ ├─Sort(Build) 9990.00 root test.t2.b", + "│ │ └─TableReader 9990.00 root data:Selection", + "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", + "│ │ └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo", + "│ └─Sort(Probe) 9990.00 root test.t1.b", + "│ └─TableReader 9990.00 root data:Selection", + "│ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", + "│ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + "└─TableReader(Probe) 9990.00 root data:Selection", + " └─Selection 9990.00 cop[tikv] not(isnull(test.t.a))", + " └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain format = 'brief' select /*+ qb_name(qb_v_2, v@sel_1 .@sel_2), merge_join(t1@qb_v_2), stream_agg(@qb_v_2), qb_name(qb_v_1, v@sel_1 .@sel_1), merge_join(t@qb_v_1) */ * from v;", + "Plan": [ + "MergeJoin 9990.00 root inner join, left key:test.t.a, right key:Column#10", + "├─Sort(Build) 7992.00 root Column#10", + "│ └─StreamAgg 7992.00 root group by:test.t2.a, funcs:count(1)->Column#10", + "│ └─Sort 12487.50 root test.t2.a", + "│ └─MergeJoin 12487.50 root inner join, left key:test.t1.b, right key:test.t2.b", + "│ ├─Sort(Build) 9990.00 root test.t2.b", + "│ │ └─TableReader 9990.00 root data:Selection", + "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", + "│ │ └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo", + "│ └─Sort(Probe) 9990.00 root test.t1.b", + "│ └─TableReader 9990.00 root data:Selection", + "│ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", + "│ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + "└─Sort(Probe) 9990.00 root test.t.a", + " └─TableReader 9990.00 root data:Selection", + " └─Selection 9990.00 cop[tikv] not(isnull(test.t.a))", + " └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain format = 'brief' select /*+ qb_name(qb_v_2, v1@sel_1 . v@sel_2 .@sel_2), merge_join(t1@qb_v_2) */ * from v1;", + "Plan": [ + "HashJoin 9980.01 root inner join, equal:[eq(test.t.a, Column#17)]", + "├─HashAgg(Build) 7984.01 root group by:test.t.a, funcs:count(1)->Column#17", + "│ └─HashJoin 12475.01 root inner join, equal:[eq(test.t.a, Column#16)]", + "│ ├─HashAgg(Build) 7992.00 root group by:test.t2.a, funcs:count(1)->Column#16", + "│ │ └─MergeJoin 12487.50 root inner join, left key:test.t1.b, right key:test.t2.b", + "│ │ ├─Sort(Build) 9990.00 root test.t2.b", + "│ │ │ └─TableReader 9990.00 root data:Selection", + "│ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", + "│ │ │ └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo", + "│ │ └─Sort(Probe) 9990.00 root test.t1.b", + "│ │ └─TableReader 9990.00 root data:Selection", + "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", + "│ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + "│ └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t.b, test.t1.b)]", + "│ ├─TableReader(Build) 9990.00 root data:Selection", + "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", + "│ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + "│ └─TableReader(Probe) 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 keep order:false, stats:pseudo", + "└─TableReader(Probe) 9990.00 root data:Selection", + " └─Selection 9990.00 cop[tikv] not(isnull(test.t.a))", + " └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain format = 'brief' select /*+ qb_name(qb_v_2, v1@sel_1 . v@sel_2 .@sel_2), merge_join(t1@qb_v_2), stream_agg(@qb_v_2), qb_name(qb_v_1, v1@sel_1 . v@sel_2 .@sel_1), merge_join(t@qb_v_1) */ * from v1;", + "Plan": [ + "HashJoin 9980.01 root inner join, equal:[eq(test.t.a, Column#17)]", + "├─HashAgg(Build) 7984.01 root group by:test.t.a, funcs:count(1)->Column#17", + "│ └─HashJoin 12475.01 root inner join, equal:[eq(test.t.a, Column#16)]", + "│ ├─StreamAgg(Build) 7992.00 root group by:test.t2.a, funcs:count(1)->Column#16", + "│ │ └─Sort 12487.50 root test.t2.a", + "│ │ └─MergeJoin 12487.50 root inner join, left key:test.t1.b, right key:test.t2.b", + "│ │ ├─Sort(Build) 9990.00 root test.t2.b", + "│ │ │ └─TableReader 9990.00 root data:Selection", + "│ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", + "│ │ │ └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo", + "│ │ └─Sort(Probe) 9990.00 root test.t1.b", + "│ │ └─TableReader 9990.00 root data:Selection", + "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", + "│ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + "│ └─MergeJoin(Probe) 12475.01 root inner join, left key:test.t.b, right key:test.t1.b", + "│ ├─Sort(Build) 9990.00 root test.t1.b", + "│ │ └─TableReader 9990.00 root data:Selection", + "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", + "│ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + "│ └─Sort(Probe) 9980.01 root test.t.b", + "│ └─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 keep order:false, stats:pseudo", + "└─TableReader(Probe) 9990.00 root data:Selection", + " └─Selection 9990.00 cop[tikv] not(isnull(test.t.a))", + " └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain format = 'brief' select /*+ qb_name(qb_v_2, v2@sel_1 . v1@sel_2 . v@sel_2 .@sel_2), merge_join(t1@qb_v_2) */ * from v2;", + "Plan": [ + "HashJoin 9980.01 root inner join, equal:[eq(test.t.a, Column#24)]", + "├─HashAgg(Build) 7984.01 root group by:test.t.a, funcs:count(1)->Column#24", + "│ └─HashJoin 12475.01 root inner join, equal:[eq(test.t.a, Column#23)]", + "│ ├─HashAgg(Build) 7984.01 root group by:test.t.a, funcs:count(1)->Column#23", + "│ │ └─HashJoin 12475.01 root inner join, equal:[eq(test.t.a, Column#22)]", + "│ │ ├─HashAgg(Build) 7992.00 root group by:test.t2.a, funcs:count(1)->Column#22", + "│ │ │ └─MergeJoin 12487.50 root inner join, left key:test.t1.b, right key:test.t2.b", + "│ │ │ ├─Sort(Build) 9990.00 root test.t2.b", + "│ │ │ │ └─TableReader 9990.00 root data:Selection", + "│ │ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", + "│ │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo", + "│ │ │ └─Sort(Probe) 9990.00 root test.t1.b", + "│ │ │ └─TableReader 9990.00 root data:Selection", + "│ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", + "│ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + "│ │ └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t.b, test.t1.b)]", + "│ │ ├─TableReader(Build) 9990.00 root data:Selection", + "│ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", + "│ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + "│ │ └─TableReader(Probe) 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 keep order:false, stats:pseudo", + "│ └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t.b, test.t1.b)]", + "│ ├─TableReader(Build) 9990.00 root data:Selection", + "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", + "│ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + "│ └─TableReader(Probe) 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 keep order:false, stats:pseudo", + "└─TableReader(Probe) 9990.00 root data:Selection", + " └─Selection 9990.00 cop[tikv] not(isnull(test.t.a))", + " └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain format = 'brief' select /*+ qb_name(qb_v_2, v2@sel_1 . v1@sel_2 . v@sel_2 .@sel_2), merge_join(t1@qb_v_2), stream_agg(@qb_v_2), qb_name(qb_v_1, v2@sel_1 . v1@sel_2 . v@sel_2 .@sel_1), merge_join(t@qb_v_1) */ * from v2;", + "Plan": [ + "HashJoin 9980.01 root inner join, equal:[eq(test.t.a, Column#24)]", + "├─HashAgg(Build) 7984.01 root group by:test.t.a, funcs:count(1)->Column#24", + "│ └─HashJoin 12475.01 root inner join, equal:[eq(test.t.a, Column#23)]", + "│ ├─HashAgg(Build) 7984.01 root group by:test.t.a, funcs:count(1)->Column#23", + "│ │ └─HashJoin 12475.01 root inner join, equal:[eq(test.t.a, Column#22)]", + "│ │ ├─StreamAgg(Build) 7992.00 root group by:test.t2.a, funcs:count(1)->Column#22", + "│ │ │ └─Sort 12487.50 root test.t2.a", + "│ │ │ └─MergeJoin 12487.50 root inner join, left key:test.t1.b, right key:test.t2.b", + "│ │ │ ├─Sort(Build) 9990.00 root test.t2.b", + "│ │ │ │ └─TableReader 9990.00 root data:Selection", + "│ │ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", + "│ │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo", + "│ │ │ └─Sort(Probe) 9990.00 root test.t1.b", + "│ │ │ └─TableReader 9990.00 root data:Selection", + "│ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", + "│ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + "│ │ └─MergeJoin(Probe) 12475.01 root inner join, left key:test.t.b, right key:test.t1.b", + "│ │ ├─Sort(Build) 9990.00 root test.t1.b", + "│ │ │ └─TableReader 9990.00 root data:Selection", + "│ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", + "│ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + "│ │ └─Sort(Probe) 9980.01 root test.t.b", + "│ │ └─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 keep order:false, stats:pseudo", + "│ └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t.b, test.t1.b)]", + "│ ├─TableReader(Build) 9990.00 root data:Selection", + "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", + "│ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + "│ └─TableReader(Probe) 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 keep order:false, stats:pseudo", + "└─TableReader(Probe) 9990.00 root data:Selection", + " └─Selection 9990.00 cop[tikv] not(isnull(test.t.a))", + " └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain format = 'brief' select /*+ qb_name(qb_v1_2, v1@sel_1 .@sel_2), merge_join(t1@qb_v1_2) */ * from v1;", + "Plan": [ + "HashJoin 9980.01 root inner join, equal:[eq(test.t.a, Column#17)]", + "├─HashAgg(Build) 7984.01 root group by:test.t.a, funcs:count(1)->Column#17", + "│ └─HashJoin 12475.01 root inner join, equal:[eq(test.t.a, Column#16)]", + "│ ├─HashAgg(Build) 7992.00 root group by:test.t2.a, funcs:count(1)->Column#16", + "│ │ └─HashJoin 12487.50 root inner join, equal:[eq(test.t1.b, test.t2.b)]", + "│ │ ├─TableReader(Build) 9990.00 root data:Selection", + "│ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", + "│ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + "│ │ └─TableReader(Probe) 9990.00 root data:Selection", + "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", + "│ │ └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo", + "│ └─MergeJoin(Probe) 12475.01 root inner join, left key:test.t.b, right key:test.t1.b", + "│ ├─Sort(Build) 9990.00 root test.t1.b", + "│ │ └─TableReader 9990.00 root data:Selection", + "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", + "│ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + "│ └─Sort(Probe) 9980.01 root test.t.b", + "│ └─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 keep order:false, stats:pseudo", + "└─TableReader(Probe) 9990.00 root data:Selection", + " └─Selection 9990.00 cop[tikv] not(isnull(test.t.a))", + " └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain format = 'brief' select /*+ qb_name(qb_v1_2, v1@sel_1 .@sel_2), merge_join(t1@qb_v1_2), stream_agg(@qb_v1_2), qb_name(qb_v1_1, v1@sel_1 .@sel_1), merge_join(t@qb_v1_1) */ * from v1;", + "Plan": [ + "MergeJoin 9980.01 root inner join, left key:test.t.a, right key:Column#17", + "├─Sort(Build) 7984.01 root Column#17", + "│ └─StreamAgg 7984.01 root group by:test.t.a, funcs:count(1)->Column#17", + "│ └─Sort 12475.01 root test.t.a", + "│ └─HashJoin 12475.01 root inner join, equal:[eq(test.t.a, Column#16)]", + "│ ├─HashAgg(Build) 7992.00 root group by:test.t2.a, funcs:count(1)->Column#16", + "│ │ └─HashJoin 12487.50 root inner join, equal:[eq(test.t1.b, test.t2.b)]", + "│ │ ├─TableReader(Build) 9990.00 root data:Selection", + "│ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", + "│ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + "│ │ └─TableReader(Probe) 9990.00 root data:Selection", + "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", + "│ │ └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo", + "│ └─MergeJoin(Probe) 12475.01 root inner join, left key:test.t.b, right key:test.t1.b", + "│ ├─Sort(Build) 9990.00 root test.t1.b", + "│ │ └─TableReader 9990.00 root data:Selection", + "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", + "│ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + "│ └─Sort(Probe) 9980.01 root test.t.b", + "│ └─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 keep order:false, stats:pseudo", + "└─Sort(Probe) 9990.00 root test.t.a", + " └─TableReader 9990.00 root data:Selection", + " └─Selection 9990.00 cop[tikv] not(isnull(test.t.a))", + " └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain format = 'brief' select /*+ qb_name(qb_v1_2, v2@sel_1 . v1@sel_2 .@sel_2), merge_join(t1@qb_v1_2) */ * from v2;", + "Plan": [ + "HashJoin 9980.01 root inner join, equal:[eq(test.t.a, Column#24)]", + "├─HashAgg(Build) 7984.01 root group by:test.t.a, funcs:count(1)->Column#24", + "│ └─HashJoin 12475.01 root inner join, equal:[eq(test.t.a, Column#23)]", + "│ ├─HashAgg(Build) 7984.01 root group by:test.t.a, funcs:count(1)->Column#23", + "│ │ └─HashJoin 12475.01 root inner join, equal:[eq(test.t.a, Column#22)]", + "│ │ ├─HashAgg(Build) 7992.00 root group by:test.t2.a, funcs:count(1)->Column#22", + "│ │ │ └─HashJoin 12487.50 root inner join, equal:[eq(test.t1.b, test.t2.b)]", + "│ │ │ ├─TableReader(Build) 9990.00 root data:Selection", + "│ │ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", + "│ │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + "│ │ │ └─TableReader(Probe) 9990.00 root data:Selection", + "│ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", + "│ │ │ └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo", + "│ │ └─MergeJoin(Probe) 12475.01 root inner join, left key:test.t.b, right key:test.t1.b", + "│ │ ├─Sort(Build) 9990.00 root test.t1.b", + "│ │ │ └─TableReader 9990.00 root data:Selection", + "│ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", + "│ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + "│ │ └─Sort(Probe) 9980.01 root test.t.b", + "│ │ └─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 keep order:false, stats:pseudo", + "│ └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t.b, test.t1.b)]", + "│ ├─TableReader(Build) 9990.00 root data:Selection", + "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", + "│ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + "│ └─TableReader(Probe) 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 keep order:false, stats:pseudo", + "└─TableReader(Probe) 9990.00 root data:Selection", + " └─Selection 9990.00 cop[tikv] not(isnull(test.t.a))", + " └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain format = 'brief' select /*+ qb_name(qb_v1_2, v2@sel_1 . v1@sel_2 .@sel_2), merge_join(t1@qb_v1_2), stream_agg(@qb_v1_2), qb_name(qb_v1_1, v2@sel_1 . v1@sel_2 .@sel_1), merge_join(t@qb_v1_1) */ * from v2;", + "Plan": [ + "HashJoin 9980.01 root inner join, equal:[eq(test.t.a, Column#24)]", + "├─HashAgg(Build) 7984.01 root group by:test.t.a, funcs:count(1)->Column#24", + "│ └─HashJoin 12475.01 root inner join, equal:[eq(test.t.a, Column#23)]", + "│ ├─StreamAgg(Build) 7984.01 root group by:test.t.a, funcs:count(1)->Column#23", + "│ │ └─Sort 12475.01 root test.t.a", + "│ │ └─HashJoin 12475.01 root inner join, equal:[eq(test.t.a, Column#22)]", + "│ │ ├─HashAgg(Build) 7992.00 root group by:test.t2.a, funcs:count(1)->Column#22", + "│ │ │ └─HashJoin 12487.50 root inner join, equal:[eq(test.t1.b, test.t2.b)]", + "│ │ │ ├─TableReader(Build) 9990.00 root data:Selection", + "│ │ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", + "│ │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + "│ │ │ └─TableReader(Probe) 9990.00 root data:Selection", + "│ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", + "│ │ │ └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo", + "│ │ └─MergeJoin(Probe) 12475.01 root inner join, left key:test.t.b, right key:test.t1.b", + "│ │ ├─Sort(Build) 9990.00 root test.t1.b", + "│ │ │ └─TableReader 9990.00 root data:Selection", + "│ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", + "│ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + "│ │ └─Sort(Probe) 9980.01 root test.t.b", + "│ │ └─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 keep order:false, stats:pseudo", + "│ └─MergeJoin(Probe) 12475.01 root inner join, left key:test.t.b, right key:test.t1.b", + "│ ├─Sort(Build) 9990.00 root test.t1.b", + "│ │ └─TableReader 9990.00 root data:Selection", + "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", + "│ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + "│ └─Sort(Probe) 9980.01 root test.t.b", + "│ └─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 keep order:false, stats:pseudo", + "└─TableReader(Probe) 9990.00 root data:Selection", + " └─Selection 9990.00 cop[tikv] not(isnull(test.t.a))", + " └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain format = 'brief' select /*+ qb_name(qb_v2_2, v2@sel_1 .@sel_2), merge_join(t1@qb_v2_2) */ * from v2;", + "Plan": [ + "HashJoin 9980.01 root inner join, equal:[eq(test.t.a, Column#24)]", + "├─HashAgg(Build) 7984.01 root group by:test.t.a, funcs:count(1)->Column#24", + "│ └─HashJoin 12475.01 root inner join, equal:[eq(test.t.a, Column#23)]", + "│ ├─HashAgg(Build) 7984.01 root group by:test.t.a, funcs:count(1)->Column#23", + "│ │ └─HashJoin 12475.01 root inner join, equal:[eq(test.t.a, Column#22)]", + "│ │ ├─HashAgg(Build) 7992.00 root group by:test.t2.a, funcs:count(1)->Column#22", + "│ │ │ └─HashJoin 12487.50 root inner join, equal:[eq(test.t1.b, test.t2.b)]", + "│ │ │ ├─TableReader(Build) 9990.00 root data:Selection", + "│ │ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", + "│ │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + "│ │ │ └─TableReader(Probe) 9990.00 root data:Selection", + "│ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", + "│ │ │ └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo", + "│ │ └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t.b, test.t1.b)]", + "│ │ ├─TableReader(Build) 9990.00 root data:Selection", + "│ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", + "│ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + "│ │ └─TableReader(Probe) 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 keep order:false, stats:pseudo", + "│ └─MergeJoin(Probe) 12475.01 root inner join, left key:test.t.b, right key:test.t1.b", + "│ ├─Sort(Build) 9990.00 root test.t1.b", + "│ │ └─TableReader 9990.00 root data:Selection", + "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", + "│ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + "│ └─Sort(Probe) 9980.01 root test.t.b", + "│ └─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 keep order:false, stats:pseudo", + "└─TableReader(Probe) 9990.00 root data:Selection", + " └─Selection 9990.00 cop[tikv] not(isnull(test.t.a))", + " └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain format = 'brief' select /*+ qb_name(qb_v2_2, v2@sel_1 .@sel_2), merge_join(t1@qb_v2_2), stream_agg(@qb_v2_2), qb_name(qb_v2_1, v2), merge_join(t@qb_v2_1) */ * from v2;", + "Plan": [ + "MergeJoin 9980.01 root inner join, left key:test.t.a, right key:Column#24", + "├─Sort(Build) 7984.01 root Column#24", + "│ └─StreamAgg 7984.01 root group by:test.t.a, funcs:count(1)->Column#24", + "│ └─Sort 12475.01 root test.t.a", + "│ └─HashJoin 12475.01 root inner join, equal:[eq(test.t.a, Column#23)]", + "│ ├─HashAgg(Build) 7984.01 root group by:test.t.a, funcs:count(1)->Column#23", + "│ │ └─HashJoin 12475.01 root inner join, equal:[eq(test.t.a, Column#22)]", + "│ │ ├─HashAgg(Build) 7992.00 root group by:test.t2.a, funcs:count(1)->Column#22", + "│ │ │ └─HashJoin 12487.50 root inner join, equal:[eq(test.t1.b, test.t2.b)]", + "│ │ │ ├─TableReader(Build) 9990.00 root data:Selection", + "│ │ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", + "│ │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + "│ │ │ └─TableReader(Probe) 9990.00 root data:Selection", + "│ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", + "│ │ │ └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo", + "│ │ └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t.b, test.t1.b)]", + "│ │ ├─TableReader(Build) 9990.00 root data:Selection", + "│ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", + "│ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + "│ │ └─TableReader(Probe) 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 keep order:false, stats:pseudo", + "│ └─MergeJoin(Probe) 12475.01 root inner join, left key:test.t.b, right key:test.t1.b", + "│ ├─Sort(Build) 9990.00 root test.t1.b", + "│ │ └─TableReader 9990.00 root data:Selection", + "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", + "│ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + "│ └─Sort(Probe) 9980.01 root test.t.b", + "│ └─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 keep order:false, stats:pseudo", + "└─Sort(Probe) 9990.00 root test.t.a", + " └─TableReader 9990.00 root data:Selection", + " └─Selection 9990.00 cop[tikv] not(isnull(test.t.a))", + " └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo" + ], + "Warn": null + } + ] + }, + { + "Name": "TestViewHintScope", + "Cases": [ + { + "SQL": "explain format = 'brief' select /*+ qb_name(qb_v, v@sel_1 .@sel_2), qb_name(qb_v, v@sel_1 .@sel_1), merge_join(t1@qb_v) */ * from v;", + "Plan": [ + "HashJoin 9980.01 root inner join, equal:[eq(test.t.a, Column#13)]", + "├─HashAgg(Build) 7984.01 root group by:test.t2.a, funcs:count(1)->Column#13", + "│ └─HashJoin 15593.77 root inner join, equal:[eq(test.t2.a, test.t3.a)]", + "│ ├─TableReader(Build) 9990.00 root data:Selection", + "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t3.a))", + "│ │ └─TableFullScan 10000.00 cop[tikv] table:t3 keep order:false, stats:pseudo", + "│ └─MergeJoin(Probe) 12475.01 root inner join, left key:test.t2.b, right key:test.t1.b", + "│ ├─Sort(Build) 9990.00 root test.t1.b", + "│ │ └─TableReader 9990.00 root data:Selection", + "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", + "│ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + "│ └─Sort(Probe) 9980.01 root test.t2.b", + "│ └─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 keep order:false, stats:pseudo", + "└─TableReader(Probe) 9990.00 root data:Selection", + " └─Selection 9990.00 cop[tikv] not(isnull(test.t.a))", + " └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo" + ], + "Warn": [ + "Duplicate query block name qb_v for view's query block hint, only the first one is effective" + ] + }, + { + "SQL": "explain format = 'brief' select /*+ qb_name(qb_v, v1@sel_1 .v@sel_2 .@sel_2), qb_name(qb_v, v1@sel_1 .v@sel_2 .@sel_1), merge_join(t1@qb_v) */ * from v1;", + "Plan": [ + "HashJoin 9980.01 root inner join, equal:[eq(test.t.a, Column#20)]", + "├─HashAgg(Build) 7984.01 root group by:test.t.a, funcs:count(1)->Column#20", + "│ └─HashJoin 12475.01 root inner join, equal:[eq(test.t.a, Column#19)]", + "│ ├─HashAgg(Build) 7984.01 root group by:test.t2.a, funcs:count(1)->Column#19", + "│ │ └─HashJoin 15593.77 root inner join, equal:[eq(test.t2.a, test.t3.a)]", + "│ │ ├─TableReader(Build) 9990.00 root data:Selection", + "│ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t3.a))", + "│ │ │ └─TableFullScan 10000.00 cop[tikv] table:t3 keep order:false, stats:pseudo", + "│ │ └─MergeJoin(Probe) 12475.01 root inner join, left key:test.t2.b, right key:test.t1.b", + "│ │ ├─Sort(Build) 9990.00 root test.t1.b", + "│ │ │ └─TableReader 9990.00 root data:Selection", + "│ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", + "│ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + "│ │ └─Sort(Probe) 9980.01 root test.t2.b", + "│ │ └─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 keep order:false, stats:pseudo", + "│ └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t.b, test.t1.b)]", + "│ ├─TableReader(Build) 9990.00 root data:Selection", + "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", + "│ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + "│ └─TableReader(Probe) 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 keep order:false, stats:pseudo", + "└─TableReader(Probe) 9990.00 root data:Selection", + " └─Selection 9990.00 cop[tikv] not(isnull(test.t.a))", + " └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo" + ], + "Warn": [ + "Duplicate query block name qb_v for view's query block hint, only the first one is effective" + ] + }, + { + "SQL": "explain format = 'brief' select /*+ qb_name(qb_v, v2@sel_1 .v1@sel_2 .v@sel_2 .@sel_2), qb_name(qb_v, v2@sel_1 .v1@sel_2 .v@sel_2 .@sel_1), merge_join(t1@qb_v) */ * from v2;", + "Plan": [ + "HashJoin 9980.01 root inner join, equal:[eq(test.t.a, Column#27)]", + "├─HashAgg(Build) 7984.01 root group by:test.t.a, funcs:count(1)->Column#27", + "│ └─HashJoin 12475.01 root inner join, equal:[eq(test.t.a, Column#26)]", + "│ ├─HashAgg(Build) 7984.01 root group by:test.t.a, funcs:count(1)->Column#26", + "│ │ └─HashJoin 12475.01 root inner join, equal:[eq(test.t.a, Column#25)]", + "│ │ ├─HashAgg(Build) 7984.01 root group by:test.t2.a, funcs:count(1)->Column#25", + "│ │ │ └─HashJoin 15593.77 root inner join, equal:[eq(test.t2.a, test.t3.a)]", + "│ │ │ ├─TableReader(Build) 9990.00 root data:Selection", + "│ │ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t3.a))", + "│ │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t3 keep order:false, stats:pseudo", + "│ │ │ └─MergeJoin(Probe) 12475.01 root inner join, left key:test.t2.b, right key:test.t1.b", + "│ │ │ ├─Sort(Build) 9990.00 root test.t1.b", + "│ │ │ │ └─TableReader 9990.00 root data:Selection", + "│ │ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", + "│ │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + "│ │ │ └─Sort(Probe) 9980.01 root test.t2.b", + "│ │ │ └─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 keep order:false, stats:pseudo", + "│ │ └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t.b, test.t1.b)]", + "│ │ ├─TableReader(Build) 9990.00 root data:Selection", + "│ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", + "│ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + "│ │ └─TableReader(Probe) 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 keep order:false, stats:pseudo", + "│ └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t.b, test.t1.b)]", + "│ ├─TableReader(Build) 9990.00 root data:Selection", + "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", + "│ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + "│ └─TableReader(Probe) 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 keep order:false, stats:pseudo", + "└─TableReader(Probe) 9990.00 root data:Selection", + " └─Selection 9990.00 cop[tikv] not(isnull(test.t.a))", + " └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo" + ], + "Warn": [ + "Duplicate query block name qb_v for view's query block hint, only the first one is effective" + ] + }, + { + "SQL": "explain format = 'brief' select /*+ qb_name(qb_v1_2, v@sel_1 .@sel_2), merge_join(t1@qb_v1_2) */ * from v1;", + "Plan": [ + "HashJoin 9980.01 root inner join, equal:[eq(test.t.a, Column#20)]", + "├─HashAgg(Build) 7984.01 root group by:test.t.a, funcs:count(1)->Column#20", + "│ └─HashJoin 12475.01 root inner join, equal:[eq(test.t.a, Column#19)]", + "│ ├─HashAgg(Build) 7984.01 root group by:test.t2.a, funcs:count(1)->Column#19", + "│ │ └─HashJoin 15593.77 root inner join, equal:[eq(test.t2.a, test.t3.a)]", + "│ │ ├─TableReader(Build) 9990.00 root data:Selection", + "│ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t3.a))", + "│ │ │ └─TableFullScan 10000.00 cop[tikv] table:t3 keep order:false, stats:pseudo", + "│ │ └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t2.b, test.t1.b)]", + "│ │ ├─TableReader(Build) 9990.00 root data:Selection", + "│ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", + "│ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + "│ │ └─TableReader(Probe) 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 keep order:false, stats:pseudo", + "│ └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t.b, test.t1.b)]", + "│ ├─TableReader(Build) 9990.00 root data:Selection", + "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", + "│ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + "│ └─TableReader(Probe) 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 keep order:false, stats:pseudo", + "└─TableReader(Probe) 9990.00 root data:Selection", + " └─Selection 9990.00 cop[tikv] not(isnull(test.t.a))", + " └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo" + ], + "Warn": [ + "The qb_name hint qb_v1_2 is unused, please check whether the table list in the qb_name hint qb_v1_2 is correct" + ] + }, + { + "SQL": "explain format = 'brief' select /*+ qb_name(qb_v1_2, v2@sel_1 . v@sel_1 .@sel_2), merge_join(t1@qb_v1_2) */ * from v2;", + "Plan": [ + "HashJoin 9980.01 root inner join, equal:[eq(test.t.a, Column#27)]", + "├─HashAgg(Build) 7984.01 root group by:test.t.a, funcs:count(1)->Column#27", + "│ └─HashJoin 12475.01 root inner join, equal:[eq(test.t.a, Column#26)]", + "│ ├─HashAgg(Build) 7984.01 root group by:test.t.a, funcs:count(1)->Column#26", + "│ │ └─HashJoin 12475.01 root inner join, equal:[eq(test.t.a, Column#25)]", + "│ │ ├─HashAgg(Build) 7984.01 root group by:test.t2.a, funcs:count(1)->Column#25", + "│ │ │ └─HashJoin 15593.77 root inner join, equal:[eq(test.t2.a, test.t3.a)]", + "│ │ │ ├─TableReader(Build) 9990.00 root data:Selection", + "│ │ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t3.a))", + "│ │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t3 keep order:false, stats:pseudo", + "│ │ │ └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t2.b, test.t1.b)]", + "│ │ │ ├─TableReader(Build) 9990.00 root data:Selection", + "│ │ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", + "│ │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + "│ │ │ └─TableReader(Probe) 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 keep order:false, stats:pseudo", + "│ │ └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t.b, test.t1.b)]", + "│ │ ├─TableReader(Build) 9990.00 root data:Selection", + "│ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", + "│ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + "│ │ └─TableReader(Probe) 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 keep order:false, stats:pseudo", + "│ └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t.b, test.t1.b)]", + "│ ├─TableReader(Build) 9990.00 root data:Selection", + "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", + "│ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + "│ └─TableReader(Probe) 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 keep order:false, stats:pseudo", + "└─TableReader(Probe) 9990.00 root data:Selection", + " └─Selection 9990.00 cop[tikv] not(isnull(test.t.a))", + " └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo" + ], + "Warn": [ + "The qb_name hint qb_v1_2 is unused, please check whether the table list in the qb_name hint qb_v1_2 is correct" + ] + }, + { + "SQL": "explain format = 'brief' select /*+ qb_name(qb_v2_2, vv@sel_1 .@sel_2), merge_join(t1@qb_v2_2) */ * from v2 vv;", + "Plan": [ + "HashJoin 9980.01 root inner join, equal:[eq(test.t.a, Column#27)]", + "├─HashAgg(Build) 7984.01 root group by:test.t.a, funcs:count(1)->Column#27", + "│ └─HashJoin 12475.01 root inner join, equal:[eq(test.t.a, Column#26)]", + "│ ├─HashAgg(Build) 7984.01 root group by:test.t.a, funcs:count(1)->Column#26", + "│ │ └─HashJoin 12475.01 root inner join, equal:[eq(test.t.a, Column#25)]", + "│ │ ├─HashAgg(Build) 7984.01 root group by:test.t2.a, funcs:count(1)->Column#25", + "│ │ │ └─HashJoin 15593.77 root inner join, equal:[eq(test.t2.a, test.t3.a)]", + "│ │ │ ├─TableReader(Build) 9990.00 root data:Selection", + "│ │ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t3.a))", + "│ │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t3 keep order:false, stats:pseudo", + "│ │ │ └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t2.b, test.t1.b)]", + "│ │ │ ├─TableReader(Build) 9990.00 root data:Selection", + "│ │ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", + "│ │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + "│ │ │ └─TableReader(Probe) 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 keep order:false, stats:pseudo", + "│ │ └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t.b, test.t1.b)]", + "│ │ ├─TableReader(Build) 9990.00 root data:Selection", + "│ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", + "│ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + "│ │ └─TableReader(Probe) 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 keep order:false, stats:pseudo", + "│ └─MergeJoin(Probe) 12475.01 root inner join, left key:test.t.b, right key:test.t1.b", + "│ ├─Sort(Build) 9990.00 root test.t1.b", + "│ │ └─TableReader 9990.00 root data:Selection", + "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", + "│ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + "│ └─Sort(Probe) 9980.01 root test.t.b", + "│ └─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 keep order:false, stats:pseudo", + "└─TableReader(Probe) 9990.00 root data:Selection", + " └─Selection 9990.00 cop[tikv] not(isnull(test.t.a))", + " └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain format = 'brief' select /*+ qb_name(qb_v2_2, v2@sel_1 .@sel_2), merge_join(t1@qb_v2_2) */ * from v2 vv;", + "Plan": [ + "HashJoin 9980.01 root inner join, equal:[eq(test.t.a, Column#27)]", + "├─HashAgg(Build) 7984.01 root group by:test.t.a, funcs:count(1)->Column#27", + "│ └─HashJoin 12475.01 root inner join, equal:[eq(test.t.a, Column#26)]", + "│ ├─HashAgg(Build) 7984.01 root group by:test.t.a, funcs:count(1)->Column#26", + "│ │ └─HashJoin 12475.01 root inner join, equal:[eq(test.t.a, Column#25)]", + "│ │ ├─HashAgg(Build) 7984.01 root group by:test.t2.a, funcs:count(1)->Column#25", + "│ │ │ └─HashJoin 15593.77 root inner join, equal:[eq(test.t2.a, test.t3.a)]", + "│ │ │ ├─TableReader(Build) 9990.00 root data:Selection", + "│ │ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t3.a))", + "│ │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t3 keep order:false, stats:pseudo", + "│ │ │ └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t2.b, test.t1.b)]", + "│ │ │ ├─TableReader(Build) 9990.00 root data:Selection", + "│ │ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", + "│ │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + "│ │ │ └─TableReader(Probe) 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 keep order:false, stats:pseudo", + "│ │ └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t.b, test.t1.b)]", + "│ │ ├─TableReader(Build) 9990.00 root data:Selection", + "│ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", + "│ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + "│ │ └─TableReader(Probe) 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 keep order:false, stats:pseudo", + "│ └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t.b, test.t1.b)]", + "│ ├─TableReader(Build) 9990.00 root data:Selection", + "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", + "│ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + "│ └─TableReader(Probe) 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 keep order:false, stats:pseudo", + "└─TableReader(Probe) 9990.00 root data:Selection", + " └─Selection 9990.00 cop[tikv] not(isnull(test.t.a))", + " └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo" + ], + "Warn": [ + "The qb_name hint qb_v2_2 is unused, please check whether the table list in the qb_name hint qb_v2_2 is correct" + ] + }, + { + "SQL": "explain format = 'brief' select * from (select /*+ qb_name(qb_v_2, v@sel_1 .@sel_2), merge_join(t1@qb_v_2) */ * from v) t;", + "Plan": [ + "HashJoin 9980.01 root inner join, equal:[eq(test.t.a, Column#13)]", + "├─HashAgg(Build) 7984.01 root group by:test.t2.a, funcs:count(1)->Column#13", + "│ └─HashJoin 15593.77 root inner join, equal:[eq(test.t2.a, test.t3.a)]", + "│ ├─TableReader(Build) 9990.00 root data:Selection", + "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t3.a))", + "│ │ └─TableFullScan 10000.00 cop[tikv] table:t3 keep order:false, stats:pseudo", + "│ └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t2.b, test.t1.b)]", + "│ ├─TableReader(Build) 9990.00 root data:Selection", + "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", + "│ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + "│ └─TableReader(Probe) 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 keep order:false, stats:pseudo", + "└─TableReader(Probe) 9990.00 root data:Selection", + " └─Selection 9990.00 cop[tikv] not(isnull(test.t.a))", + " └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo" + ], + "Warn": [ + "The qb_name hint qb_v_2 is unused, please check whether the table list in the qb_name hint qb_v_2 is correct" + ] + }, + { + "SQL": "explain format = 'brief' select * from (select /*+ qb_name(qb_v_2, v.@sel_2), merge_join(t1@qb_v_2), stream_agg(@qb_v_2), qb_name(qb_v_1, v@sel_1 .@sel1), merge_join(t@qb_v_1) */ * from v) t;", + "Plan": [ + "HashJoin 9980.01 root inner join, equal:[eq(test.t.a, Column#13)]", + "├─StreamAgg(Build) 7984.01 root group by:test.t2.a, funcs:count(1)->Column#13", + "│ └─Sort 15593.77 root test.t2.a", + "│ └─HashJoin 15593.77 root inner join, equal:[eq(test.t2.a, test.t3.a)]", + "│ ├─TableReader(Build) 9990.00 root data:Selection", + "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t3.a))", + "│ │ └─TableFullScan 10000.00 cop[tikv] table:t3 keep order:false, stats:pseudo", + "│ └─MergeJoin(Probe) 12475.01 root inner join, left key:test.t2.b, right key:test.t1.b", + "│ ├─Sort(Build) 9990.00 root test.t1.b", + "│ │ └─TableReader 9990.00 root data:Selection", + "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", + "│ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + "│ └─Sort(Probe) 9980.01 root test.t2.b", + "│ └─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 keep order:false, stats:pseudo", + "└─TableReader(Probe) 9990.00 root data:Selection", + " └─Selection 9990.00 cop[tikv] not(isnull(test.t.a))", + " └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo" + ], + "Warn": [ + "The qb_name hint qb_v_1 is unused, please check whether the table list in the qb_name hint qb_v_1 is correct" + ] + }, + { + "SQL": "explain format = 'brief' select * from (select /*+ qb_name(qb_v_2, v1@sel_1 . v@sel_2 .@sel_2), merge_join(t1@qb_v_2) */ * from v1) t;", + "Plan": [ + "HashJoin 9980.01 root inner join, equal:[eq(test.t.a, Column#20)]", + "├─HashAgg(Build) 7984.01 root group by:test.t.a, funcs:count(1)->Column#20", + "│ └─HashJoin 12475.01 root inner join, equal:[eq(test.t.a, Column#19)]", + "│ ├─HashAgg(Build) 7984.01 root group by:test.t2.a, funcs:count(1)->Column#19", + "│ │ └─HashJoin 15593.77 root inner join, equal:[eq(test.t2.a, test.t3.a)]", + "│ │ ├─TableReader(Build) 9990.00 root data:Selection", + "│ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t3.a))", + "│ │ │ └─TableFullScan 10000.00 cop[tikv] table:t3 keep order:false, stats:pseudo", + "│ │ └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t2.b, test.t1.b)]", + "│ │ ├─TableReader(Build) 9990.00 root data:Selection", + "│ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", + "│ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + "│ │ └─TableReader(Probe) 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 keep order:false, stats:pseudo", + "│ └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t.b, test.t1.b)]", + "│ ├─TableReader(Build) 9990.00 root data:Selection", + "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", + "│ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + "│ └─TableReader(Probe) 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 keep order:false, stats:pseudo", + "└─TableReader(Probe) 9990.00 root data:Selection", + " └─Selection 9990.00 cop[tikv] not(isnull(test.t.a))", + " └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo" + ], + "Warn": [ + "The qb_name hint qb_v_2 is unused, please check whether the table list in the qb_name hint qb_v_2 is correct" + ] + }, + { + "SQL": "explain format = 'brief' select * from (select /*+ qb_name(qb_v_2, v1.v@sel_2 .@sel_2), merge_join(t1@qb_v_2), stream_agg(@qb_v_2), qb_name(qb_v_1, v1@sel_1 . v@sel_2 .@sel_1), merge_join(t@qb_v_1) */ * from v1) t;", + "Plan": [ + "HashJoin 9980.01 root inner join, equal:[eq(test.t.a, Column#20)]", + "├─HashAgg(Build) 7984.01 root group by:test.t.a, funcs:count(1)->Column#20", + "│ └─HashJoin 12475.01 root inner join, equal:[eq(test.t.a, Column#19)]", + "│ ├─StreamAgg(Build) 7984.01 root group by:test.t2.a, funcs:count(1)->Column#19", + "│ │ └─Sort 15593.77 root test.t2.a", + "│ │ └─HashJoin 15593.77 root inner join, equal:[eq(test.t2.a, test.t3.a)]", + "│ │ ├─TableReader(Build) 9990.00 root data:Selection", + "│ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t3.a))", + "│ │ │ └─TableFullScan 10000.00 cop[tikv] table:t3 keep order:false, stats:pseudo", + "│ │ └─MergeJoin(Probe) 12475.01 root inner join, left key:test.t2.b, right key:test.t1.b", + "│ │ ├─Sort(Build) 9990.00 root test.t1.b", + "│ │ │ └─TableReader 9990.00 root data:Selection", + "│ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", + "│ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + "│ │ └─Sort(Probe) 9980.01 root test.t2.b", + "│ │ └─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 keep order:false, stats:pseudo", + "│ └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t.b, test.t1.b)]", + "│ ├─TableReader(Build) 9990.00 root data:Selection", + "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", + "│ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + "│ └─TableReader(Probe) 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 keep order:false, stats:pseudo", + "└─TableReader(Probe) 9990.00 root data:Selection", + " └─Selection 9990.00 cop[tikv] not(isnull(test.t.a))", + " └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo" + ], + "Warn": [ + "The qb_name hint qb_v_1 is unused, please check whether the table list in the qb_name hint qb_v_1 is correct" + ] + }, + { + "SQL": "explain format = 'brief' select /*+ qb_name(qb_v_2, v@sel_2 .@sel_2) */ * from (select /*+ merge_join(t1@qb_v_2) */ * from v) t;", + "Plan": [ + "HashJoin 9980.01 root inner join, equal:[eq(test.t.a, Column#13)]", + "├─HashAgg(Build) 7984.01 root group by:test.t2.a, funcs:count(1)->Column#13", + "│ └─HashJoin 15593.77 root inner join, equal:[eq(test.t2.a, test.t3.a)]", + "│ ├─TableReader(Build) 9990.00 root data:Selection", + "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t3.a))", + "│ │ └─TableFullScan 10000.00 cop[tikv] table:t3 keep order:false, stats:pseudo", + "│ └─MergeJoin(Probe) 12475.01 root inner join, left key:test.t2.b, right key:test.t1.b", + "│ ├─Sort(Build) 9990.00 root test.t1.b", + "│ │ └─TableReader 9990.00 root data:Selection", + "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", + "│ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + "│ └─Sort(Probe) 9980.01 root test.t2.b", + "│ └─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 keep order:false, stats:pseudo", + "└─TableReader(Probe) 9990.00 root data:Selection", + " └─Selection 9990.00 cop[tikv] not(isnull(test.t.a))", + " └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain format = 'brief' select /*+ qb_name(qb_v_2, v@sel_2 .@sel_2), qb_name(qb_v_1, v@sel_2 .@sel1) */ * from (select /*+ merge_join(t1@qb_v_2), stream_agg(@qb_v_2), merge_join(t@qb_v_1) */ * from v) t;", + "Plan": [ + "HashJoin 9980.01 root inner join, equal:[eq(test.t.a, Column#13)]", + "├─StreamAgg(Build) 7984.01 root group by:test.t2.a, funcs:count(1)->Column#13", + "│ └─Sort 15593.77 root test.t2.a", + "│ └─HashJoin 15593.77 root inner join, equal:[eq(test.t2.a, test.t3.a)]", + "│ ├─TableReader(Build) 9990.00 root data:Selection", + "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t3.a))", + "│ │ └─TableFullScan 10000.00 cop[tikv] table:t3 keep order:false, stats:pseudo", + "│ └─MergeJoin(Probe) 12475.01 root inner join, left key:test.t2.b, right key:test.t1.b", + "│ ├─Sort(Build) 9990.00 root test.t1.b", + "│ │ └─TableReader 9990.00 root data:Selection", + "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", + "│ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + "│ └─Sort(Probe) 9980.01 root test.t2.b", + "│ └─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 keep order:false, stats:pseudo", + "└─TableReader(Probe) 9990.00 root data:Selection", + " └─Selection 9990.00 cop[tikv] not(isnull(test.t.a))", + " └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo" + ], + "Warn": [ + "The qb_name hint qb_v_1 is unused, please check whether the table list in the qb_name hint qb_v_1 is correct" + ] + }, + { + "SQL": "explain format = 'brief' select /*+ qb_name(qb_v_2, v1@sel_2 . v@sel_2 .@sel_2) */ * from (select /*+ merge_join(t1@qb_v_2) */ * from v1) t;", + "Plan": [ + "HashJoin 9980.01 root inner join, equal:[eq(test.t.a, Column#20)]", + "├─HashAgg(Build) 7984.01 root group by:test.t.a, funcs:count(1)->Column#20", + "│ └─HashJoin 12475.01 root inner join, equal:[eq(test.t.a, Column#19)]", + "│ ├─HashAgg(Build) 7984.01 root group by:test.t2.a, funcs:count(1)->Column#19", + "│ │ └─HashJoin 15593.77 root inner join, equal:[eq(test.t2.a, test.t3.a)]", + "│ │ ├─TableReader(Build) 9990.00 root data:Selection", + "│ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t3.a))", + "│ │ │ └─TableFullScan 10000.00 cop[tikv] table:t3 keep order:false, stats:pseudo", + "│ │ └─MergeJoin(Probe) 12475.01 root inner join, left key:test.t2.b, right key:test.t1.b", + "│ │ ├─Sort(Build) 9990.00 root test.t1.b", + "│ │ │ └─TableReader 9990.00 root data:Selection", + "│ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", + "│ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + "│ │ └─Sort(Probe) 9980.01 root test.t2.b", + "│ │ └─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 keep order:false, stats:pseudo", + "│ └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t.b, test.t1.b)]", + "│ ├─TableReader(Build) 9990.00 root data:Selection", + "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", + "│ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + "│ └─TableReader(Probe) 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 keep order:false, stats:pseudo", + "└─TableReader(Probe) 9990.00 root data:Selection", + " └─Selection 9990.00 cop[tikv] not(isnull(test.t.a))", + " └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain format = 'brief' select /*+ qb_name(qb_v_2, v1@sel_2 . v@sel_2 .@sel_2), qb_name(qb_v_1, v1@sel_2 . v@sel_2 .@sel_1) */ * from (select /*+ merge_join(t1@qb_v_2), stream_agg(@qb_v_2), merge_join(t@qb_v_1) */ * from v1) t;", + "Plan": [ + "HashJoin 9980.01 root inner join, equal:[eq(test.t.a, Column#20)]", + "├─HashAgg(Build) 7984.01 root group by:test.t.a, funcs:count(1)->Column#20", + "│ └─HashJoin 12475.01 root inner join, equal:[eq(test.t.a, Column#19)]", + "│ ├─StreamAgg(Build) 7984.01 root group by:test.t2.a, funcs:count(1)->Column#19", + "│ │ └─Sort 15593.77 root test.t2.a", + "│ │ └─HashJoin 15593.77 root inner join, equal:[eq(test.t2.a, test.t3.a)]", + "│ │ ├─TableReader(Build) 9990.00 root data:Selection", + "│ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t3.a))", + "│ │ │ └─TableFullScan 10000.00 cop[tikv] table:t3 keep order:false, stats:pseudo", + "│ │ └─MergeJoin(Probe) 12475.01 root inner join, left key:test.t2.b, right key:test.t1.b", + "│ │ ├─Sort(Build) 9990.00 root test.t1.b", + "│ │ │ └─TableReader 9990.00 root data:Selection", + "│ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", + "│ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + "│ │ └─Sort(Probe) 9980.01 root test.t2.b", + "│ │ └─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 keep order:false, stats:pseudo", + "│ └─MergeJoin(Probe) 12475.01 root inner join, left key:test.t.b, right key:test.t1.b", + "│ ├─Sort(Build) 9990.00 root test.t1.b", + "│ │ └─TableReader 9990.00 root data:Selection", + "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", + "│ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + "│ └─Sort(Probe) 9980.01 root test.t.b", + "│ └─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 keep order:false, stats:pseudo", + "└─TableReader(Probe) 9990.00 root data:Selection", + " └─Selection 9990.00 cop[tikv] not(isnull(test.t.a))", + " └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain format = 'brief' select /*+ qb_name(qb_v1_2, v2. v1@sel_2 .@sel_2), qb_name(qb_v1_1, v2@sel_1 . v1@sel_2 .@sel_1), merge_join(t1@qb_v1_2, t@qb_v1_1), merge_join(t1@qb_v1_2) */ * from v2;", + "Plan": [ + "HashJoin 9980.01 root inner join, equal:[eq(test.t.a, Column#27)]", + "├─HashAgg(Build) 7984.01 root group by:test.t.a, funcs:count(1)->Column#27", + "│ └─HashJoin 12475.01 root inner join, equal:[eq(test.t.a, Column#26)]", + "│ ├─HashAgg(Build) 7984.01 root group by:test.t.a, funcs:count(1)->Column#26", + "│ │ └─HashJoin 12475.01 root inner join, equal:[eq(test.t.a, Column#25)]", + "│ │ ├─HashAgg(Build) 7984.01 root group by:test.t2.a, funcs:count(1)->Column#25", + "│ │ │ └─HashJoin 15593.77 root inner join, equal:[eq(test.t2.a, test.t3.a)]", + "│ │ │ ├─TableReader(Build) 9990.00 root data:Selection", + "│ │ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t3.a))", + "│ │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t3 keep order:false, stats:pseudo", + "│ │ │ └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t2.b, test.t1.b)]", + "│ │ │ ├─TableReader(Build) 9990.00 root data:Selection", + "│ │ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", + "│ │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + "│ │ │ └─TableReader(Probe) 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 keep order:false, stats:pseudo", + "│ │ └─MergeJoin(Probe) 12475.01 root inner join, left key:test.t.b, right key:test.t1.b", + "│ │ ├─Sort(Build) 9990.00 root test.t1.b", + "│ │ │ └─TableReader 9990.00 root data:Selection", + "│ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", + "│ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + "│ │ └─Sort(Probe) 9980.01 root test.t.b", + "│ │ └─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 keep order:false, stats:pseudo", + "│ └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t.b, test.t1.b)]", + "│ ├─TableReader(Build) 9990.00 root data:Selection", + "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", + "│ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + "│ └─TableReader(Probe) 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 keep order:false, stats:pseudo", + "└─TableReader(Probe) 9990.00 root data:Selection", + " └─Selection 9990.00 cop[tikv] not(isnull(test.t.a))", + " └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo" + ], + "Warn": [ + "Only one query block name is allowed in a view hint, otherwise the hint will be invalid" + ] + }, + { + "SQL": "explain format = 'brief' select /*+ qb_name(qb_v_2, v2@sel_1 . v1@sel_2 . v@sel_2 .@sel_2), qb_name(qb_v_1, v2@sel_1 . v1@sel_2 . v@sel_2 .@sel_1), merge_join(t1@qb_v_2, t3@qb_v_2) */ * from v2;", + "Plan": [ + "HashJoin 9980.01 root inner join, equal:[eq(test.t.a, Column#27)]", + "├─HashAgg(Build) 7984.01 root group by:test.t.a, funcs:count(1)->Column#27", + "│ └─HashJoin 12475.01 root inner join, equal:[eq(test.t.a, Column#26)]", + "│ ├─HashAgg(Build) 7984.01 root group by:test.t.a, funcs:count(1)->Column#26", + "│ │ └─HashJoin 12475.01 root inner join, equal:[eq(test.t.a, Column#25)]", + "│ │ ├─HashAgg(Build) 7984.01 root group by:test.t2.a, funcs:count(1)->Column#25", + "│ │ │ └─MergeJoin 15593.77 root inner join, left key:test.t2.a, right key:test.t3.a", + "│ │ │ ├─Sort(Build) 9990.00 root test.t3.a", + "│ │ │ │ └─TableReader 9990.00 root data:Selection", + "│ │ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t3.a))", + "│ │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t3 keep order:false, stats:pseudo", + "│ │ │ └─Sort(Probe) 12475.01 root test.t2.a", + "│ │ │ └─MergeJoin 12475.01 root inner join, left key:test.t2.b, right key:test.t1.b", + "│ │ │ ├─Sort(Build) 9990.00 root test.t1.b", + "│ │ │ │ └─TableReader 9990.00 root data:Selection", + "│ │ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", + "│ │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + "│ │ │ └─Sort(Probe) 9980.01 root test.t2.b", + "│ │ │ └─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 keep order:false, stats:pseudo", + "│ │ └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t.b, test.t1.b)]", + "│ │ ├─TableReader(Build) 9990.00 root data:Selection", + "│ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", + "│ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + "│ │ └─TableReader(Probe) 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 keep order:false, stats:pseudo", + "│ └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t.b, test.t1.b)]", + "│ ├─TableReader(Build) 9990.00 root data:Selection", + "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", + "│ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + "│ └─TableReader(Probe) 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 keep order:false, stats:pseudo", + "└─TableReader(Probe) 9990.00 root data:Selection", + " └─Selection 9990.00 cop[tikv] not(isnull(test.t.a))", + " └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain format = 'brief' select /*+ qb_name(qb_v_2, v2@sel_1 . v1@sel_2 . v@sel_2 .@sel_2), qb_name(qb_v_1, v2@sel_1 . v1@sel_2 . v@sel_2 .@sel_1), merge_join(@qb_v_2 t1, t3) */ * from v2;", + "Plan": [ + "HashJoin 9980.01 root inner join, equal:[eq(test.t.a, Column#27)]", + "├─HashAgg(Build) 7984.01 root group by:test.t.a, funcs:count(1)->Column#27", + "│ └─HashJoin 12475.01 root inner join, equal:[eq(test.t.a, Column#26)]", + "│ ├─HashAgg(Build) 7984.01 root group by:test.t.a, funcs:count(1)->Column#26", + "│ │ └─HashJoin 12475.01 root inner join, equal:[eq(test.t.a, Column#25)]", + "│ │ ├─HashAgg(Build) 7984.01 root group by:test.t2.a, funcs:count(1)->Column#25", + "│ │ │ └─MergeJoin 15593.77 root inner join, left key:test.t2.a, right key:test.t3.a", + "│ │ │ ├─Sort(Build) 9990.00 root test.t3.a", + "│ │ │ │ └─TableReader 9990.00 root data:Selection", + "│ │ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t3.a))", + "│ │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t3 keep order:false, stats:pseudo", + "│ │ │ └─Sort(Probe) 12475.01 root test.t2.a", + "│ │ │ └─MergeJoin 12475.01 root inner join, left key:test.t2.b, right key:test.t1.b", + "│ │ │ ├─Sort(Build) 9990.00 root test.t1.b", + "│ │ │ │ └─TableReader 9990.00 root data:Selection", + "│ │ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", + "│ │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + "│ │ │ └─Sort(Probe) 9980.01 root test.t2.b", + "│ │ │ └─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 keep order:false, stats:pseudo", + "│ │ └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t.b, test.t1.b)]", + "│ │ ├─TableReader(Build) 9990.00 root data:Selection", + "│ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", + "│ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + "│ │ └─TableReader(Probe) 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 keep order:false, stats:pseudo", + "│ └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t.b, test.t1.b)]", + "│ ├─TableReader(Build) 9990.00 root data:Selection", + "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", + "│ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + "│ └─TableReader(Probe) 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 keep order:false, stats:pseudo", + "└─TableReader(Probe) 9990.00 root data:Selection", + " └─Selection 9990.00 cop[tikv] not(isnull(test.t.a))", + " └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain format = 'brief' select /*+ qb_name(qb_v_2, v .@sel_2), merge_join(t1@qb_v_2) */ * from v;", + "Plan": [ + "HashJoin 9980.01 root inner join, equal:[eq(test.t.a, Column#13)]", + "├─HashAgg(Build) 7984.01 root group by:test.t2.a, funcs:count(1)->Column#13", + "│ └─HashJoin 15593.77 root inner join, equal:[eq(test.t2.a, test.t3.a)]", + "│ ├─TableReader(Build) 9990.00 root data:Selection", + "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t3.a))", + "│ │ └─TableFullScan 10000.00 cop[tikv] table:t3 keep order:false, stats:pseudo", + "│ └─MergeJoin(Probe) 12475.01 root inner join, left key:test.t2.b, right key:test.t1.b", + "│ ├─Sort(Build) 9990.00 root test.t1.b", + "│ │ └─TableReader 9990.00 root data:Selection", + "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", + "│ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + "│ └─Sort(Probe) 9980.01 root test.t2.b", + "│ └─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 keep order:false, stats:pseudo", + "└─TableReader(Probe) 9990.00 root data:Selection", + " └─Selection 9990.00 cop[tikv] not(isnull(test.t.a))", + " └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain format = 'brief' select /*+ qb_name(qb_v_1, v@sel_1), merge_join(t@qb_v_1) */ * from v;", + "Plan": [ + "MergeJoin 9980.01 root inner join, left key:test.t.a, right key:Column#13", + "├─Sort(Build) 7984.01 root Column#13", + "│ └─HashAgg 7984.01 root group by:test.t2.a, funcs:count(1)->Column#13", + "│ └─HashJoin 15593.77 root inner join, equal:[eq(test.t2.a, test.t3.a)]", + "│ ├─TableReader(Build) 9990.00 root data:Selection", + "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t3.a))", + "│ │ └─TableFullScan 10000.00 cop[tikv] table:t3 keep order:false, stats:pseudo", + "│ └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t2.b, test.t1.b)]", + "│ ├─TableReader(Build) 9990.00 root data:Selection", + "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", + "│ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + "│ └─TableReader(Probe) 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 keep order:false, stats:pseudo", + "└─Sort(Probe) 9990.00 root test.t.a", + " └─TableReader 9990.00 root data:Selection", + " └─Selection 9990.00 cop[tikv] not(isnull(test.t.a))", + " └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain format = 'brief' select /*+ qb_name(qb_v_2, v1 .v@sel_2 .@sel_2), merge_join(t1@qb_v_2) */ * from v1;", + "Plan": [ + "HashJoin 9980.01 root inner join, equal:[eq(test.t.a, Column#20)]", + "├─HashAgg(Build) 7984.01 root group by:test.t.a, funcs:count(1)->Column#20", + "│ └─HashJoin 12475.01 root inner join, equal:[eq(test.t.a, Column#19)]", + "│ ├─HashAgg(Build) 7984.01 root group by:test.t2.a, funcs:count(1)->Column#19", + "│ │ └─HashJoin 15593.77 root inner join, equal:[eq(test.t2.a, test.t3.a)]", + "│ │ ├─TableReader(Build) 9990.00 root data:Selection", + "│ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t3.a))", + "│ │ │ └─TableFullScan 10000.00 cop[tikv] table:t3 keep order:false, stats:pseudo", + "│ │ └─MergeJoin(Probe) 12475.01 root inner join, left key:test.t2.b, right key:test.t1.b", + "│ │ ├─Sort(Build) 9990.00 root test.t1.b", + "│ │ │ └─TableReader 9990.00 root data:Selection", + "│ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", + "│ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + "│ │ └─Sort(Probe) 9980.01 root test.t2.b", + "│ │ └─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 keep order:false, stats:pseudo", + "│ └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t.b, test.t1.b)]", + "│ ├─TableReader(Build) 9990.00 root data:Selection", + "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", + "│ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + "│ └─TableReader(Probe) 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 keep order:false, stats:pseudo", + "└─TableReader(Probe) 9990.00 root data:Selection", + " └─Selection 9990.00 cop[tikv] not(isnull(test.t.a))", + " └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain format = 'brief' select /*+ qb_name(qb_v_1, v1 .v@sel_2), merge_join(t@qb_v_1) */ * from v1;", + "Plan": [ + "HashJoin 9980.01 root inner join, equal:[eq(test.t.a, Column#20)]", + "├─HashAgg(Build) 7984.01 root group by:test.t.a, funcs:count(1)->Column#20", + "│ └─HashJoin 12475.01 root inner join, equal:[eq(test.t.a, Column#19)]", + "│ ├─HashAgg(Build) 7984.01 root group by:test.t2.a, funcs:count(1)->Column#19", + "│ │ └─HashJoin 15593.77 root inner join, equal:[eq(test.t2.a, test.t3.a)]", + "│ │ ├─TableReader(Build) 9990.00 root data:Selection", + "│ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t3.a))", + "│ │ │ └─TableFullScan 10000.00 cop[tikv] table:t3 keep order:false, stats:pseudo", + "│ │ └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t2.b, test.t1.b)]", + "│ │ ├─TableReader(Build) 9990.00 root data:Selection", + "│ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", + "│ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + "│ │ └─TableReader(Probe) 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 keep order:false, stats:pseudo", + "│ └─MergeJoin(Probe) 12475.01 root inner join, left key:test.t.b, right key:test.t1.b", + "│ ├─Sort(Build) 9990.00 root test.t1.b", + "│ │ └─TableReader 9990.00 root data:Selection", + "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", + "│ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + "│ └─Sort(Probe) 9980.01 root test.t.b", + "│ └─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 keep order:false, stats:pseudo", + "└─TableReader(Probe) 9990.00 root data:Selection", + " └─Selection 9990.00 cop[tikv] not(isnull(test.t.a))", + " └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain format = 'brief' select /*+ merge_join(t1@qb_v_2), qb_name(qb_v_2, v@sel_1 .@sel_2) */ * from v;", + "Plan": [ + "HashJoin 9980.01 root inner join, equal:[eq(test.t.a, Column#13)]", + "├─HashAgg(Build) 7984.01 root group by:test.t2.a, funcs:count(1)->Column#13", + "│ └─HashJoin 15593.77 root inner join, equal:[eq(test.t2.a, test.t3.a)]", + "│ ├─TableReader(Build) 9990.00 root data:Selection", + "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t3.a))", + "│ │ └─TableFullScan 10000.00 cop[tikv] table:t3 keep order:false, stats:pseudo", + "│ └─MergeJoin(Probe) 12475.01 root inner join, left key:test.t2.b, right key:test.t1.b", + "│ ├─Sort(Build) 9990.00 root test.t1.b", + "│ │ └─TableReader 9990.00 root data:Selection", + "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", + "│ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + "│ └─Sort(Probe) 9980.01 root test.t2.b", + "│ └─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 keep order:false, stats:pseudo", + "└─TableReader(Probe) 9990.00 root data:Selection", + " └─Selection 9990.00 cop[tikv] not(isnull(test.t.a))", + " └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain format = 'brief' select /*+ merge_join(t@qb_v_1), stream_agg(@qb_v_2), qb_name(qb_v_2, v@sel_1 .@sel_2), qb_name(qb_v_1, v@sel_1 .@sel_1) */ * from v;", + "Plan": [ + "MergeJoin 9980.01 root inner join, left key:test.t.a, right key:Column#13", + "├─Sort(Build) 7984.01 root Column#13", + "│ └─StreamAgg 7984.01 root group by:test.t2.a, funcs:count(1)->Column#13", + "│ └─Sort 15593.77 root test.t2.a", + "│ └─HashJoin 15593.77 root inner join, equal:[eq(test.t2.a, test.t3.a)]", + "│ ├─TableReader(Build) 9990.00 root data:Selection", + "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t3.a))", + "│ │ └─TableFullScan 10000.00 cop[tikv] table:t3 keep order:false, stats:pseudo", + "│ └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t2.b, test.t1.b)]", + "│ ├─TableReader(Build) 9990.00 root data:Selection", + "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", + "│ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + "│ └─TableReader(Probe) 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 keep order:false, stats:pseudo", + "└─Sort(Probe) 9990.00 root test.t.a", + " └─TableReader 9990.00 root data:Selection", + " └─Selection 9990.00 cop[tikv] not(isnull(test.t.a))", + " └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain format = 'brief' select /*+ qb_name(qb_v3_2, v3@sel_1 .@sel_2), merge_join(t1@qb_v3_2) */ * from v3;", + "Plan": [ + "MergeJoin 9980.01 root inner join, left key:test.t.a, right key:Column#27", + "├─Sort(Build) 7984.01 root Column#27", + "│ └─StreamAgg 7984.01 root group by:test.t.a, funcs:count(1)->Column#27", + "│ └─Sort 12475.01 root test.t.a", + "│ └─HashJoin 12475.01 root inner join, equal:[eq(test.t.a, Column#26)]", + "│ ├─HashAgg(Build) 7984.01 root group by:test.t.a, funcs:count(1)->Column#26", + "│ │ └─HashJoin 12475.01 root inner join, equal:[eq(test.t.a, Column#25)]", + "│ │ ├─HashAgg(Build) 7984.01 root group by:test.t2.a, funcs:count(1)->Column#25", + "│ │ │ └─HashJoin 15593.77 root inner join, equal:[eq(test.t2.a, test.t3.a)]", + "│ │ │ ├─TableReader(Build) 9990.00 root data:Selection", + "│ │ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t3.a))", + "│ │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t3 keep order:false, stats:pseudo", + "│ │ │ └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t2.b, test.t1.b)]", + "│ │ │ ├─TableReader(Build) 9990.00 root data:Selection", + "│ │ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", + "│ │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + "│ │ │ └─TableReader(Probe) 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 keep order:false, stats:pseudo", + "│ │ └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t.b, test.t1.b)]", + "│ │ ├─TableReader(Build) 9990.00 root data:Selection", + "│ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", + "│ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + "│ │ └─TableReader(Probe) 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 keep order:false, stats:pseudo", + "│ └─MergeJoin(Probe) 12475.01 root inner join, left key:test.t.b, right key:test.t1.b", + "│ ├─Sort(Build) 9990.00 root test.t1.b", + "│ │ └─TableReader 9990.00 root data:Selection", + "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", + "│ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + "│ └─Sort(Probe) 9980.01 root test.t.b", + "│ └─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 keep order:false, stats:pseudo", + "└─Sort(Probe) 9990.00 root test.t.a", + " └─TableReader 9990.00 root data:Selection", + " └─Selection 9990.00 cop[tikv] not(isnull(test.t.a))", + " └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain format = 'brief' select /*+ qb_name(qb_v3_2, v3@sel_1 .@sel_2), merge_join(t1@qb_v3_2), hash_agg(@qb_v3_2), qb_name(qb_v3_1, v3@sel_1 .@sel_1), hash_join(t@qb_v3_1) */ * from v3;", + "Plan": [ + "HashJoin 9980.01 root inner join, equal:[eq(test.t.a, Column#27)]", + "├─HashAgg(Build) 7984.01 root group by:test.t.a, funcs:count(1)->Column#27", + "│ └─HashJoin 12475.01 root inner join, equal:[eq(test.t.a, Column#26)]", + "│ ├─HashAgg(Build) 7984.01 root group by:test.t.a, funcs:count(1)->Column#26", + "│ │ └─HashJoin 12475.01 root inner join, equal:[eq(test.t.a, Column#25)]", + "│ │ ├─HashAgg(Build) 7984.01 root group by:test.t2.a, funcs:count(1)->Column#25", + "│ │ │ └─HashJoin 15593.77 root inner join, equal:[eq(test.t2.a, test.t3.a)]", + "│ │ │ ├─TableReader(Build) 9990.00 root data:Selection", + "│ │ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t3.a))", + "│ │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t3 keep order:false, stats:pseudo", + "│ │ │ └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t2.b, test.t1.b)]", + "│ │ │ ├─TableReader(Build) 9990.00 root data:Selection", + "│ │ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", + "│ │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + "│ │ │ └─TableReader(Probe) 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 keep order:false, stats:pseudo", + "│ │ └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t.b, test.t1.b)]", + "│ │ ├─TableReader(Build) 9990.00 root data:Selection", + "│ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", + "│ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + "│ │ └─TableReader(Probe) 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 keep order:false, stats:pseudo", + "│ └─MergeJoin(Probe) 12475.01 root inner join, left key:test.t.b, right key:test.t1.b", + "│ ├─Sort(Build) 9990.00 root test.t1.b", + "│ │ └─TableReader 9990.00 root data:Selection", + "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", + "│ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + "│ └─Sort(Probe) 9980.01 root test.t.b", + "│ └─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 keep order:false, stats:pseudo", + "└─TableReader(Probe) 9990.00 root data:Selection", + " └─Selection 9990.00 cop[tikv] not(isnull(test.t.a))", + " └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo" + ], + "Warn": [ + "[planner:1815]Join hints are conflict, you can only specify one type of join", + "[planner:1815]Optimizer aggregation hints are conflicted" + ] + }, + { + "SQL": "explain with d1 as (\n select a from (\n select a from (\n select /*+ qb_name(qb, v4) use_index(t4@qb, idx_a) */ a from v4 where a < 10\n ) as t0 where a < 9\n ) as t1 where a < 8\n), d2 as (select /*+ qb_name(qb2, v4) use_index(t4@qb2, idx_b) */ a from v4 where b < 10)\n\nselect * from (select * from d1) as t0 join (select * from d2) as t1;", + "Plan": [ + "HashJoin_41 6944.44 root CARTESIAN inner join", + "├─IndexLookUp_50(Build) 83.33 root ", + "│ ├─IndexRangeScan_47(Build) 250.00 cop[tikv] table:t4, index:idx_b(b) range:(3,10), keep order:false, stats:pseudo", + "│ └─Selection_49(Probe) 83.33 cop[tikv] gt(test.t4.a, 2)", + "│ └─TableRowIDScan_48 250.00 cop[tikv] table:t4 keep order:false, stats:pseudo", + "└─IndexLookUp_46(Probe) 83.33 root ", + " ├─IndexRangeScan_43(Build) 250.00 cop[tikv] table:t4, index:idx_a(a) range:(2,8), keep order:false, stats:pseudo", + " └─Selection_45(Probe) 83.33 cop[tikv] gt(test.t4.b, 3)", + " └─TableRowIDScan_44 250.00 cop[tikv] table:t4 keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain with d1 as (\n select a from (\n select a from (\n select a from v4 where a < 10\n ) as t0 where a < 9\n ) as t1 where a < 8\n), d2 as (select a from v4 where b < 10)\n\nselect /*+ qb_name(qb, v4@sel_4) use_index(t4@qb, idx_a) qb_name(qb2, v4@sel_5) use_index(t4@qb, idx_b) */ * from (select * from d1) as t0 join (select * from d2) as t1;", + "Plan": [ + "HashJoin_41 6944.44 root CARTESIAN inner join", + "├─TableReader_53(Build) 83.33 root data:Selection_52", + "│ └─Selection_52 83.33 cop[tikv] gt(test.t4.a, 2), gt(test.t4.b, 3), lt(test.t4.b, 10)", + "│ └─TableFullScan_51 10000.00 cop[tikv] table:t4 keep order:false, stats:pseudo", + "└─IndexLookUp_46(Probe) 83.33 root ", + " ├─IndexRangeScan_43(Build) 250.00 cop[tikv] table:t4, index:idx_a(a) range:(2,8), keep order:false, stats:pseudo", + " └─Selection_45(Probe) 83.33 cop[tikv] gt(test.t4.b, 3)", + " └─TableRowIDScan_44 250.00 cop[tikv] table:t4 keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain with d1 as (\n select a from (\n select a from (\n select /*+ qb_name(qb, v5) use_index(t4@qb, idx_a) */ a from v4 where a < 10\n ) as t0 where a < 9\n ) as t1 where a < 8\n), d2 as (select /*+ qb_name(qb2, v4) use_index(t4@qb2, idx_b) */ a from v4 where b < 10)\n\nselect * from (select * from d1) as t0 join (select * from d2) as t1;", + "Plan": [ + "HashJoin_41 6944.44 root CARTESIAN inner join", + "├─IndexLookUp_57(Build) 83.33 root ", + "│ ├─IndexRangeScan_54(Build) 250.00 cop[tikv] table:t4, index:idx_b(b) range:(3,10), keep order:false, stats:pseudo", + "│ └─Selection_56(Probe) 83.33 cop[tikv] gt(test.t4.a, 2)", + "│ └─TableRowIDScan_55 250.00 cop[tikv] table:t4 keep order:false, stats:pseudo", + "└─TableReader_45(Probe) 83.33 root data:Selection_44", + " └─Selection_44 83.33 cop[tikv] gt(test.t4.a, 2), gt(test.t4.b, 3), lt(test.t4.a, 10), lt(test.t4.a, 8), lt(test.t4.a, 9)", + " └─TableFullScan_43 10000.00 cop[tikv] table:t4 keep order:false, stats:pseudo" + ], + "Warn": [ + "The qb_name hint qb is unused, please check whether the table list in the qb_name hint qb is correct" + ] + } + ] + }, + { + "Name": "TestAllViewHintType", + "Cases": [ + { + "SQL": "explain format = 'brief' select /*+ qb_name(qb_v1, v1), leading(@qb_v1 v, t2) */ * from v1;", + "Plan": [ + "HashJoin 19492.21 root inner join, equal:[eq(test.t.a, test.t1.a)]", + "├─IndexReader(Build) 10000.00 root index:IndexFullScan", + "│ └─IndexFullScan 10000.00 cop[tikv] table:t1, index:idx_a(a) keep order:false, stats:pseudo", + "└─HashJoin(Probe) 15593.77 root inner join, equal:[eq(test.t3.a, test.t.a)]", + " ├─TableReader(Build) 10000.00 root MppVersion: 2, data:ExchangeSender", + " │ └─ExchangeSender 10000.00 mpp[tiflash] ExchangeType: PassThrough", + " │ └─TableFullScan 10000.00 mpp[tiflash] table:t keep order:false, stats:pseudo", + " └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t3.b, test.t2.b)]", + " ├─TableReader(Build) 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 keep order:false, stats:pseudo", + " └─TableReader(Probe) 9990.00 root data:Selection", + " └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", + " └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo" + ], + "Warn": [ + "[planner:1815]We can only use one leading hint at most, when multiple leading hints are used, all leading hints will be invalid" + ] + }, + { + "SQL": "explain format = 'brief' select /*+ qb_name(qb_v1, v1), leading(v@qb_v1, t2@qb_v1) */ * from v1;", + "Plan": [ + "HashJoin 19492.21 root inner join, equal:[eq(test.t.a, test.t1.a)]", + "├─IndexReader(Build) 10000.00 root index:IndexFullScan", + "│ └─IndexFullScan 10000.00 cop[tikv] table:t1, index:idx_a(a) keep order:false, stats:pseudo", + "└─HashJoin(Probe) 15593.77 root inner join, equal:[eq(test.t3.a, test.t.a)]", + " ├─TableReader(Build) 10000.00 root MppVersion: 2, data:ExchangeSender", + " │ └─ExchangeSender 10000.00 mpp[tiflash] ExchangeType: PassThrough", + " │ └─TableFullScan 10000.00 mpp[tiflash] table:t keep order:false, stats:pseudo", + " └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t3.b, test.t2.b)]", + " ├─TableReader(Build) 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 keep order:false, stats:pseudo", + " └─TableReader(Probe) 9990.00 root data:Selection", + " └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", + " └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo" + ], + "Warn": [ + "[planner:1815]We can only use one leading hint at most, when multiple leading hints are used, all leading hints will be invalid" + ] + }, + { + "SQL": "explain format = 'brief' select /*+ qb_name(qb_v1, v1), leading(@qb_v1 t3, t2) */ * from v1;", + "Plan": [ + "HashJoin 19492.21 root inner join, equal:[eq(test.t.a, test.t1.a)]", + "├─IndexReader(Build) 10000.00 root index:IndexFullScan", + "│ └─IndexFullScan 10000.00 cop[tikv] table:t1, index:idx_a(a) keep order:false, stats:pseudo", + "└─HashJoin(Probe) 15593.77 root inner join, equal:[eq(test.t3.a, test.t.a)]", + " ├─TableReader(Build) 10000.00 root MppVersion: 2, data:ExchangeSender", + " │ └─ExchangeSender 10000.00 mpp[tiflash] ExchangeType: PassThrough", + " │ └─TableFullScan 10000.00 mpp[tiflash] table:t keep order:false, stats:pseudo", + " └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t3.b, test.t2.b)]", + " ├─TableReader(Build) 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 keep order:false, stats:pseudo", + " └─TableReader(Probe) 9990.00 root data:Selection", + " └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", + " └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain format = 'brief' select /*+ qb_name(qb_v1, v1), leading(t3@qb_v1, t2@qb_v1) */ * from v1;", + "Plan": [ + "HashJoin 19492.21 root inner join, equal:[eq(test.t.a, test.t1.a)]", + "├─IndexReader(Build) 10000.00 root index:IndexFullScan", + "│ └─IndexFullScan 10000.00 cop[tikv] table:t1, index:idx_a(a) keep order:false, stats:pseudo", + "└─HashJoin(Probe) 15593.77 root inner join, equal:[eq(test.t3.a, test.t.a)]", + " ├─TableReader(Build) 10000.00 root MppVersion: 2, data:ExchangeSender", + " │ └─ExchangeSender 10000.00 mpp[tiflash] ExchangeType: PassThrough", + " │ └─TableFullScan 10000.00 mpp[tiflash] table:t keep order:false, stats:pseudo", + " └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t3.b, test.t2.b)]", + " ├─TableReader(Build) 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 keep order:false, stats:pseudo", + " └─TableReader(Probe) 9990.00 root data:Selection", + " └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", + " └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain format = 'brief' select /*+ qb_name(qb_v1, v1), qb_name(qb_v, v1.v), leading(t2@qb_v1, t@qb_v) */ * from v1;", + "Plan": [ + "HashJoin 19492.21 root inner join, equal:[eq(test.t.a, test.t1.a)]", + "├─IndexReader(Build) 10000.00 root index:IndexFullScan", + "│ └─IndexFullScan 10000.00 cop[tikv] table:t1, index:idx_a(a) keep order:false, stats:pseudo", + "└─HashJoin(Probe) 15593.77 root inner join, equal:[eq(test.t3.a, test.t.a)]", + " ├─TableReader(Build) 10000.00 root MppVersion: 2, data:ExchangeSender", + " │ └─ExchangeSender 10000.00 mpp[tiflash] ExchangeType: PassThrough", + " │ └─TableFullScan 10000.00 mpp[tiflash] table:t keep order:false, stats:pseudo", + " └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t3.b, test.t2.b)]", + " ├─TableReader(Build) 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 keep order:false, stats:pseudo", + " └─TableReader(Probe) 9990.00 root data:Selection", + " └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", + " └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo" + ], + "Warn": [ + "Only one query block name is allowed in a view hint, otherwise the hint will be invalid" + ] + }, + { + "SQL": "explain format = 'brief' select /*+ qb_name(qb_v1, v1), hash_join(@qb_v1 v, t2) */ * from v1;", + "Plan": [ + "HashJoin 19492.21 root inner join, equal:[eq(test.t3.a, test.t.a)]", + "├─MergeJoin(Build) 12500.00 root inner join, left key:test.t.a, right key:test.t1.a", + "│ ├─IndexReader(Build) 10000.00 root index:IndexFullScan", + "│ │ └─IndexFullScan 10000.00 cop[tikv] table:t1, index:idx_a(a) keep order:true, stats:pseudo", + "│ └─IndexReader(Probe) 10000.00 root index:IndexFullScan", + "│ └─IndexFullScan 10000.00 cop[tikv] table:t, index:idx_a(a) keep order:true, stats:pseudo", + "└─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t3.b, test.t2.b)]", + " ├─TableReader(Build) 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 keep order:false, stats:pseudo", + " └─TableReader(Probe) 9990.00 root data:Selection", + " └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", + " └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain format = 'brief' select /*+ qb_name(qb_v1, v1), hash_join(t2@qb_v1, t3@qb_v1) */ * from v1;", + "Plan": [ + "HashJoin 19492.21 root inner join, equal:[eq(test.t.a, test.t1.a)]", + "├─IndexReader(Build) 10000.00 root index:IndexFullScan", + "│ └─IndexFullScan 10000.00 cop[tikv] table:t1, index:idx_a(a) keep order:false, stats:pseudo", + "└─HashJoin(Probe) 15593.77 root inner join, equal:[eq(test.t3.a, test.t.a)]", + " ├─TableReader(Build) 10000.00 root MppVersion: 2, data:ExchangeSender", + " │ └─ExchangeSender 10000.00 mpp[tiflash] ExchangeType: PassThrough", + " │ └─TableFullScan 10000.00 mpp[tiflash] table:t keep order:false, stats:pseudo", + " └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t3.b, test.t2.b)]", + " ├─TableReader(Build) 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 keep order:false, stats:pseudo", + " └─TableReader(Probe) 9990.00 root data:Selection", + " └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", + " └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain format = 'brief' select /*+ qb_name(qb_v1, v1), hash_join_build(@qb_v1 v) */ * from v1;", + "Plan": [ + "HashJoin 19492.21 root inner join, equal:[eq(test.t3.a, test.t.a)]", + "├─MergeJoin(Build) 12500.00 root inner join, left key:test.t.a, right key:test.t1.a", + "│ ├─IndexReader(Build) 10000.00 root index:IndexFullScan", + "│ │ └─IndexFullScan 10000.00 cop[tikv] table:t1, index:idx_a(a) keep order:true, stats:pseudo", + "│ └─IndexReader(Probe) 10000.00 root index:IndexFullScan", + "│ └─IndexFullScan 10000.00 cop[tikv] table:t, index:idx_a(a) keep order:true, stats:pseudo", + "└─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t3.b, test.t2.b)]", + " ├─TableReader(Build) 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 keep order:false, stats:pseudo", + " └─TableReader(Probe) 9990.00 root data:Selection", + " └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", + " └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain format = 'brief' select /*+ qb_name(qb_v1, v1), hash_join_build(t2@qb_v1) */ * from v1;", + "Plan": [ + "HashJoin 19492.21 root inner join, equal:[eq(test.t.a, test.t1.a)]", + "├─IndexReader(Build) 10000.00 root index:IndexFullScan", + "│ └─IndexFullScan 10000.00 cop[tikv] table:t1, index:idx_a(a) keep order:false, stats:pseudo", + "└─HashJoin(Probe) 15593.77 root inner join, equal:[eq(test.t3.a, test.t.a)]", + " ├─TableReader(Build) 10000.00 root MppVersion: 2, data:ExchangeSender", + " │ └─ExchangeSender 10000.00 mpp[tiflash] ExchangeType: PassThrough", + " │ └─TableFullScan 10000.00 mpp[tiflash] table:t keep order:false, stats:pseudo", + " └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t3.b, test.t2.b)]", + " ├─TableReader(Build) 9990.00 root data:Selection", + " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", + " │ └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo", + " └─TableReader(Probe) 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 keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain format = 'brief' select /*+ qb_name(qb_v1, v1), hash_join_build(@qb_v1 v) */ * from v1;", + "Plan": [ + "HashJoin 19492.21 root inner join, equal:[eq(test.t3.a, test.t.a)]", + "├─MergeJoin(Build) 12500.00 root inner join, left key:test.t.a, right key:test.t1.a", + "│ ├─IndexReader(Build) 10000.00 root index:IndexFullScan", + "│ │ └─IndexFullScan 10000.00 cop[tikv] table:t1, index:idx_a(a) keep order:true, stats:pseudo", + "│ └─IndexReader(Probe) 10000.00 root index:IndexFullScan", + "│ └─IndexFullScan 10000.00 cop[tikv] table:t, index:idx_a(a) keep order:true, stats:pseudo", + "└─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t3.b, test.t2.b)]", + " ├─TableReader(Build) 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 keep order:false, stats:pseudo", + " └─TableReader(Probe) 9990.00 root data:Selection", + " └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", + " └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain format = 'brief' select /*+ qb_name(qb_v1, v1), hash_join_build(t2@qb_v1) */ * from v1;", + "Plan": [ + "HashJoin 19492.21 root inner join, equal:[eq(test.t.a, test.t1.a)]", + "├─IndexReader(Build) 10000.00 root index:IndexFullScan", + "│ └─IndexFullScan 10000.00 cop[tikv] table:t1, index:idx_a(a) keep order:false, stats:pseudo", + "└─HashJoin(Probe) 15593.77 root inner join, equal:[eq(test.t3.a, test.t.a)]", + " ├─TableReader(Build) 10000.00 root MppVersion: 2, data:ExchangeSender", + " │ └─ExchangeSender 10000.00 mpp[tiflash] ExchangeType: PassThrough", + " │ └─TableFullScan 10000.00 mpp[tiflash] table:t keep order:false, stats:pseudo", + " └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t3.b, test.t2.b)]", + " ├─TableReader(Build) 9990.00 root data:Selection", + " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", + " │ └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo", + " └─TableReader(Probe) 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 keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain format = 'brief' select /*+ qb_name(qb_v1, v1), merge_join(@qb_v1 v) */ * from v1;", + "Plan": [ + "HashJoin 19492.21 root inner join, equal:[eq(test.t3.a, test.t.a)]", + "├─MergeJoin(Build) 12500.00 root inner join, left key:test.t.a, right key:test.t1.a", + "│ ├─IndexReader(Build) 10000.00 root index:IndexFullScan", + "│ │ └─IndexFullScan 10000.00 cop[tikv] table:t1, index:idx_a(a) keep order:true, stats:pseudo", + "│ └─IndexReader(Probe) 10000.00 root index:IndexFullScan", + "│ └─IndexFullScan 10000.00 cop[tikv] table:t, index:idx_a(a) keep order:true, stats:pseudo", + "└─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t3.b, test.t2.b)]", + " ├─TableReader(Build) 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 keep order:false, stats:pseudo", + " └─TableReader(Probe) 9990.00 root data:Selection", + " └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", + " └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain format = 'brief' select /*+ qb_name(qb_v1, v1), merge_join(t2@qb_v1) */ * from v1;", + "Plan": [ + "HashJoin 19492.21 root inner join, equal:[eq(test.t.a, test.t1.a)]", + "├─IndexReader(Build) 10000.00 root index:IndexFullScan", + "│ └─IndexFullScan 10000.00 cop[tikv] table:t1, index:idx_a(a) keep order:false, stats:pseudo", + "└─HashJoin(Probe) 15593.77 root inner join, equal:[eq(test.t3.a, test.t.a)]", + " ├─TableReader(Build) 10000.00 root MppVersion: 2, data:ExchangeSender", + " │ └─ExchangeSender 10000.00 mpp[tiflash] ExchangeType: PassThrough", + " │ └─TableFullScan 10000.00 mpp[tiflash] table:t keep order:false, stats:pseudo", + " └─MergeJoin(Probe) 12475.01 root inner join, left key:test.t3.b, right key:test.t2.b", + " ├─Sort(Build) 9990.00 root test.t2.b", + " │ └─TableReader 9990.00 root data:Selection", + " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", + " │ └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo", + " └─Sort(Probe) 9980.01 root test.t3.b", + " └─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 keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain format = 'brief' select /*+ qb_name(qb_v, v), INL_JOIN(@qb_v t) */ * from v;", + "Plan": [ + "IndexJoin 12500.00 root inner join, inner:IndexLookUp, outer key:test.t1.a, inner key:test.t.a, equal cond:eq(test.t1.a, test.t.a)", + "├─IndexReader(Build) 10000.00 root index:IndexFullScan", + "│ └─IndexFullScan 10000.00 cop[tikv] table:t1, index:idx_a(a) keep order:false, stats:pseudo", + "└─IndexLookUp(Probe) 12500.00 root ", + " ├─IndexRangeScan(Build) 12500.00 cop[tikv] table:t, index:idx_a(a) range: decided by [eq(test.t.a, test.t1.a)], keep order:false, stats:pseudo", + " └─TableRowIDScan(Probe) 12500.00 cop[tikv] table:t keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain format = 'brief' select /*+ qb_name(qb_v, v), INL_JOIN(t@qb_v) */ * from v;", + "Plan": [ + "IndexJoin 12500.00 root inner join, inner:IndexLookUp, outer key:test.t1.a, inner key:test.t.a, equal cond:eq(test.t1.a, test.t.a)", + "├─IndexReader(Build) 10000.00 root index:IndexFullScan", + "│ └─IndexFullScan 10000.00 cop[tikv] table:t1, index:idx_a(a) keep order:false, stats:pseudo", + "└─IndexLookUp(Probe) 12500.00 root ", + " ├─IndexRangeScan(Build) 12500.00 cop[tikv] table:t, index:idx_a(a) range: decided by [eq(test.t.a, test.t1.a)], keep order:false, stats:pseudo", + " └─TableRowIDScan(Probe) 12500.00 cop[tikv] table:t keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain format = 'brief' select /*+ qb_name(qb_v2, v2.@sel_2), hash_agg(@qb_v2) */ * from v2;", + "Plan": [ + "HashJoin 9990.00 root inner join, equal:[eq(test.t.a, Column#19)]", + "├─HashAgg(Build) 7992.00 root group by:test.t2.a, funcs:count(1)->Column#19", + "│ └─HashJoin 24365.26 root inner join, equal:[eq(test.t.a, test.t1.a)]", + "│ ├─IndexReader(Build) 10000.00 root index:IndexFullScan", + "│ │ └─IndexFullScan 10000.00 cop[tikv] table:t1, index:idx_a(a) keep order:false, stats:pseudo", + "│ └─HashJoin(Probe) 19492.21 root inner join, equal:[eq(test.t3.a, test.t.a)]", + "│ ├─TableReader(Build) 10000.00 root MppVersion: 2, data:ExchangeSender", + "│ │ └─ExchangeSender 10000.00 mpp[tiflash] ExchangeType: PassThrough", + "│ │ └─TableFullScan 10000.00 mpp[tiflash] table:t keep order:false, stats:pseudo", + "│ └─HashJoin(Probe) 15593.77 root inner join, equal:[eq(test.t2.b, test.t1.b)]", + "│ ├─TableReader(Build) 9990.00 root data:Selection", + "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", + "│ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + "│ └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t3.b, test.t2.b)]", + "│ ├─TableReader(Build) 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 keep order:false, stats:pseudo", + "│ └─TableReader(Probe) 9990.00 root data:Selection", + "│ └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", + "│ └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo", + "└─TableReader(Probe) 10000.00 root MppVersion: 2, data:ExchangeSender", + " └─ExchangeSender 10000.00 mpp[tiflash] ExchangeType: PassThrough", + " └─TableFullScan 10000.00 mpp[tiflash] table:t keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain format = 'brief' select /*+ qb_name(qb_v2, v2.@sel_2), stream_agg(@qb_v2) */ * from v2;", + "Plan": [ + "HashJoin 9990.00 root inner join, equal:[eq(test.t.a, Column#19)]", + "├─StreamAgg(Build) 7992.00 root group by:test.t2.a, funcs:count(1)->Column#19", + "│ └─Sort 24365.26 root test.t2.a", + "│ └─HashJoin 24365.26 root inner join, equal:[eq(test.t.a, test.t1.a)]", + "│ ├─IndexReader(Build) 10000.00 root index:IndexFullScan", + "│ │ └─IndexFullScan 10000.00 cop[tikv] table:t1, index:idx_a(a) keep order:false, stats:pseudo", + "│ └─HashJoin(Probe) 19492.21 root inner join, equal:[eq(test.t3.a, test.t.a)]", + "│ ├─TableReader(Build) 10000.00 root MppVersion: 2, data:ExchangeSender", + "│ │ └─ExchangeSender 10000.00 mpp[tiflash] ExchangeType: PassThrough", + "│ │ └─TableFullScan 10000.00 mpp[tiflash] table:t keep order:false, stats:pseudo", + "│ └─HashJoin(Probe) 15593.77 root inner join, equal:[eq(test.t2.b, test.t1.b)]", + "│ ├─TableReader(Build) 9990.00 root data:Selection", + "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", + "│ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + "│ └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t3.b, test.t2.b)]", + "│ ├─TableReader(Build) 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 keep order:false, stats:pseudo", + "│ └─TableReader(Probe) 9990.00 root data:Selection", + "│ └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", + "│ └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo", + "└─TableReader(Probe) 10000.00 root MppVersion: 2, data:ExchangeSender", + " └─ExchangeSender 10000.00 mpp[tiflash] ExchangeType: PassThrough", + " └─TableFullScan 10000.00 mpp[tiflash] table:t keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain format = 'brief' select /*+ qb_name(qb_v3, v3), use_index(t5@qb_v3, idx_a) */ * from v3;", + "Plan": [ + "IndexLookUp 1107.78 root ", + "├─IndexRangeScan(Build) 3333.33 cop[tikv] table:t5, index:idx_a(a) range:(1,+inf], keep order:false, stats:pseudo", + "└─Selection(Probe) 1107.78 cop[tikv] lt(test.t5.b, 2)", + " └─TableRowIDScan 3333.33 cop[tikv] table:t5 keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain format = 'brief' select /*+ qb_name(qb_v3, v3), use_index(@qb_v3 t5, idx_b) */ * from v3;", + "Plan": [ + "IndexLookUp 1107.78 root ", + "├─IndexRangeScan(Build) 3323.33 cop[tikv] table:t5, index:idx_b(b) range:[-inf,2), keep order:false, stats:pseudo", + "└─Selection(Probe) 1107.78 cop[tikv] gt(test.t5.a, 1)", + " └─TableRowIDScan 3323.33 cop[tikv] table:t5 keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain format = 'brief' select /*+ qb_name(qb_v3, v3), force_index(t5@qb_v3, idx_a) */ * from v3;", + "Plan": [ + "IndexLookUp 1107.78 root ", + "├─IndexRangeScan(Build) 3333.33 cop[tikv] table:t5, index:idx_a(a) range:(1,+inf], keep order:false, stats:pseudo", + "└─Selection(Probe) 1107.78 cop[tikv] lt(test.t5.b, 2)", + " └─TableRowIDScan 3333.33 cop[tikv] table:t5 keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain format = 'brief' select /*+ qb_name(qb_v3, v3), force_index(@qb_v3 t5, idx_b) */ * from v3;", + "Plan": [ + "IndexLookUp 1107.78 root ", + "├─IndexRangeScan(Build) 3323.33 cop[tikv] table:t5, index:idx_b(b) range:[-inf,2), keep order:false, stats:pseudo", + "└─Selection(Probe) 1107.78 cop[tikv] gt(test.t5.a, 1)", + " └─TableRowIDScan 3323.33 cop[tikv] table:t5 keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain format = 'brief' select /*+ qb_name(qb_v3, v3), ignore_index(t5@qb_v3, idx_a) */ * from v3;", + "Plan": [ + "TableReader 1107.78 root data:Selection", + "└─Selection 1107.78 cop[tikv] gt(test.t5.a, 1), lt(test.t5.b, 2)", + " └─TableFullScan 10000.00 cop[tikv] table:t5 keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain format = 'brief' select /*+ qb_name(qb_v3, v3), ignore_index(@qb_v3 t5, idx_b) */ * from v3;", + "Plan": [ + "TableReader 1107.78 root data:Selection", + "└─Selection 1107.78 cop[tikv] gt(test.t5.a, 1), lt(test.t5.b, 2)", + " └─TableFullScan 10000.00 cop[tikv] table:t5 keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain format = 'brief' select /*+ qb_name(qb_v4, v4), use_index_merge(t5@qb_v4, idx_a, idx_b) */ * from v4;", + "Plan": [ + "IndexMerge 5548.89 root type: union", + "├─IndexRangeScan(Build) 3333.33 cop[tikv] table:t5, index:idx_a(a) range:(1,+inf], keep order:false, stats:pseudo", + "├─IndexRangeScan(Build) 3323.33 cop[tikv] table:t5, index:idx_b(b) range:[-inf,2), keep order:false, stats:pseudo", + "└─TableRowIDScan(Probe) 5548.89 cop[tikv] table:t5 keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain format = 'brief' select /*+ qb_name(qb_v4, v4), use_index_merge(@qb_v4 t5, idx_b, idx_a) */ * from v4;", + "Plan": [ + "IndexMerge 5548.89 root type: union", + "├─IndexRangeScan(Build) 3333.33 cop[tikv] table:t5, index:idx_a(a) range:(1,+inf], keep order:false, stats:pseudo", + "├─IndexRangeScan(Build) 3323.33 cop[tikv] table:t5, index:idx_b(b) range:[-inf,2), keep order:false, stats:pseudo", + "└─TableRowIDScan(Probe) 5548.89 cop[tikv] table:t5 keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain format = 'brief' select /*+ qb_name(qb_v, v), READ_FROM_STORAGE(TIFLASH[t@qb_v], TIKV[t1@qb_v]) */ * from v;", + "Plan": [ + "HashJoin 12500.00 root inner join, equal:[eq(test.t.a, test.t1.a)]", + "├─IndexReader(Build) 10000.00 root index:IndexFullScan", + "│ └─IndexFullScan 10000.00 cop[tikv] table:t1, index:idx_a(a) keep order:false, stats:pseudo", + "└─TableReader(Probe) 10000.00 root MppVersion: 2, data:ExchangeSender", + " └─ExchangeSender 10000.00 mpp[tiflash] ExchangeType: PassThrough", + " └─TableFullScan 10000.00 mpp[tiflash] table:t keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain format = 'brief' select /*+ qb_name(qb_v5, v5.@sel_2), SEMI_JOIN_REWRITE(@qb_v5) */ * from v5;", + "Plan": [ + "HashJoin 9990.00 root inner join, equal:[eq(test.t.b, test.t1.b)]", + "├─HashAgg(Build) 7992.00 root group by:test.t1.b, funcs:firstrow(test.t1.b)->test.t1.b", + "│ └─TableReader 7992.00 root data:HashAgg", + "│ └─HashAgg 7992.00 cop[tikv] group by:test.t1.b, ", + "│ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", + "│ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + "└─TableReader(Probe) 9990.00 root MppVersion: 2, data:ExchangeSender", + " └─ExchangeSender 9990.00 mpp[tiflash] ExchangeType: PassThrough", + " └─Selection 9990.00 mpp[tiflash] not(isnull(test.t.b))", + " └─TableFullScan 10000.00 mpp[tiflash] table:t pushed down filter:empty, keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain format = 'brief' select /*+ qb_name(qb_v6, v6.@sel_2), NO_DECORRELATE(@qb_v6) */ * from v6;", + "Plan": [ + "Projection 10000.00 root test.t1.a, test.t1.b", + "└─Apply 10000.00 root CARTESIAN inner join, other cond:lt(cast(test.t1.a, decimal(10,0) BINARY), Column#7)", + " ├─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:sum(Column#9)->Column#7", + " └─TableReader 10000.00 root data:StreamAgg", + " └─StreamAgg 10000.00 cop[tikv] funcs:sum(test.t2.a)->Column#9", + " └─Selection 100000.00 cop[tikv] eq(test.t2.b, test.t1.b)", + " └─TableFullScan 100000000.00 cop[tikv] table:t2 keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain format = 'brief' select /*+ qb_name(qb_v7, v7), merge(@qb_v7) */ * from v7;", + "Plan": [ + "TableReader 3544.89 root MppVersion: 2, data:ExchangeSender", + "└─ExchangeSender 3544.89 mpp[tiflash] ExchangeType: PassThrough", + " └─Projection 3544.89 mpp[tiflash] Column#14, Column#15", + " └─HashAgg 3544.89 mpp[tiflash] group by:Column#14, Column#15, funcs:firstrow(Column#14)->Column#14, funcs:firstrow(Column#15)->Column#15", + " └─ExchangeReceiver 3544.89 mpp[tiflash] ", + " └─ExchangeSender 3544.89 mpp[tiflash] ExchangeType: HashPartition, Compression: FAST, Hash Cols: [name: Column#14, collate: binary], [name: Column#15, collate: binary]", + " └─HashAgg 3544.89 mpp[tiflash] group by:Column#14, Column#15, ", + " └─Union 4431.11 mpp[tiflash] ", + " ├─Projection 3323.33 mpp[tiflash] cast(test.t.a, int(11) BINARY)->Column#14, test.t.b->Column#15", + " │ └─Selection 3323.33 mpp[tiflash] lt(test.t.a, 18), lt(test.t.a, 60)", + " │ └─TableFullScan 10000.00 mpp[tiflash] table:t pushed down filter:empty, keep order:false, stats:pseudo", + " └─Projection 1107.78 mpp[tiflash] cast(test.t.a, int(11) BINARY)->Column#14, test.t.b->Column#15", + " └─Selection 1107.78 mpp[tiflash] gt(test.t.b, 1), lt(test.t.a, 60)", + " └─TableFullScan 10000.00 mpp[tiflash] table:t pushed down filter:empty, keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain format = 'brief' select /*+ qb_name(qb_v8, v8), merge(@qb_v8) */ * from v8;", + "Plan": [ + "HashAgg 16000.00 root group by:Column#21, funcs:firstrow(Column#21)->Column#21", + "└─Union 1000000010000.00 root ", + " ├─HashJoin 1000000000000.00 root CARTESIAN inner join", + " │ ├─TableReader(Build) 10000.00 root data:TableFullScan", + " │ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + " │ └─CTEFullScan(Probe) 100000000.00 root CTE:cte2 data:CTE_1", + " └─TableReader 10000.00 root data:TableFullScan", + " └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + "CTE_1 100000000.00 root Non-Recursive CTE", + "└─HashJoin(Seed Part) 100000000.00 root CARTESIAN inner join", + " ├─CTEFullScan(Build) 10000.00 root CTE:cte4 data:CTE_3", + " └─CTEFullScan(Probe) 10000.00 root CTE:cte3 data:CTE_2", + "CTE_3 10000.00 root Non-Recursive CTE", + "└─IndexReader(Seed Part) 10000.00 root index:IndexFullScan", + " └─IndexFullScan 10000.00 cop[tikv] table:t3, index:idx_a(a) keep order:false, stats:pseudo", + "CTE_2 10000.00 root Non-Recursive CTE", + "└─IndexReader(Seed Part) 10000.00 root index:IndexFullScan", + " └─IndexFullScan 10000.00 cop[tikv] table:t2, index:idx_a(a) keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain format = 'brief' select /*+ qb_name(qb_v9, v9), AGG_TO_COP(@qb_v9) */ * from v9;", + "Plan": [ + "HashAgg 1.00 root funcs:sum(Column#6)->Column#4", + "└─TableReader 1.00 root MppVersion: 2, data:ExchangeSender", + " └─ExchangeSender 1.00 mpp[tiflash] ExchangeType: PassThrough", + " └─HashAgg 1.00 mpp[tiflash] funcs:sum(Column#9)->Column#6", + " └─Projection 10000.00 mpp[tiflash] cast(test.t.a, decimal(10,0) BINARY)->Column#9", + " └─TableFullScan 10000.00 mpp[tiflash] table:t keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain format = 'brief' select /*+ qb_name(qb_v10, v10), LIMIT_TO_COP(@qb_v10) */ * from v10;", + "Plan": [ + "TopN 1.00 root test.t.b, offset:0, count:1", + "└─TableReader 1.00 root MppVersion: 2, data:ExchangeSender", + " └─ExchangeSender 1.00 mpp[tiflash] ExchangeType: PassThrough", + " └─TopN 1.00 mpp[tiflash] test.t.b, offset:0, count:1", + " └─Selection 3333.33 mpp[tiflash] gt(test.t.a, 10)", + " └─TableFullScan 10000.00 mpp[tiflash] table:t pushed down filter:empty, keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain format = 'brief' select /*+ qb_name(qb, v11) read_from_storage(tiflash[t@qb]), MPP_1PHASE_AGG(@qb) */ * from v11;", + "Plan": [ + "TableReader 8000.00 root MppVersion: 2, data:ExchangeSender", + "└─ExchangeSender 8000.00 mpp[tiflash] ExchangeType: PassThrough", + " └─Projection 8000.00 mpp[tiflash] test.t.a, Column#4", + " └─Projection 8000.00 mpp[tiflash] Column#4, test.t.a", + " └─HashAgg 8000.00 mpp[tiflash] group by:Column#7, funcs:sum(Column#5)->Column#4, funcs:firstrow(Column#6)->test.t.a", + " └─Projection 10000.00 mpp[tiflash] cast(test.t.b, decimal(10,0) BINARY)->Column#5, test.t.a->Column#6, test.t.a->Column#7", + " └─ExchangeReceiver 10000.00 mpp[tiflash] ", + " └─ExchangeSender 10000.00 mpp[tiflash] ExchangeType: HashPartition, Compression: FAST, Hash Cols: [name: test.t.a, collate: binary]", + " └─TableFullScan 10000.00 mpp[tiflash] table:t keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain format = 'brief' select /*+ qb_name(qb, v11) read_from_storage(tiflash[t@qb]), MPP_2PHASE_AGG(@qb) */ * from v11;", + "Plan": [ + "TableReader 8000.00 root MppVersion: 2, data:ExchangeSender", + "└─ExchangeSender 8000.00 mpp[tiflash] ExchangeType: PassThrough", + " └─Projection 8000.00 mpp[tiflash] test.t.a, Column#4", + " └─Projection 8000.00 mpp[tiflash] Column#4, test.t.a", + " └─HashAgg 8000.00 mpp[tiflash] group by:test.t.a, funcs:sum(Column#7)->Column#4, funcs:firstrow(test.t.a)->test.t.a", + " └─ExchangeReceiver 8000.00 mpp[tiflash] ", + " └─ExchangeSender 8000.00 mpp[tiflash] ExchangeType: HashPartition, Compression: FAST, Hash Cols: [name: test.t.a, collate: binary]", + " └─HashAgg 8000.00 mpp[tiflash] group by:Column#10, funcs:sum(Column#9)->Column#7", + " └─Projection 10000.00 mpp[tiflash] cast(test.t.b, decimal(10,0) BINARY)->Column#9, test.t.a->Column#10", + " └─TableFullScan 10000.00 mpp[tiflash] table:t keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain format = 'brief' select /*+ qb_name(qb, v12) read_from_storage(tiflash[t1@qb, t@qb]), shuffle_join(t1@qb, t@qb) */ * from v12;", + "Plan": [ + "TableReader 12500.00 root MppVersion: 2, data:ExchangeSender", + "└─ExchangeSender 12500.00 mpp[tiflash] ExchangeType: PassThrough", + " └─Projection 12500.00 mpp[tiflash] test.t.a, test.t.b", + " └─HashJoin 12500.00 mpp[tiflash] inner join, equal:[eq(test.t.a, test.t.a)]", + " ├─ExchangeReceiver(Build) 10000.00 mpp[tiflash] ", + " │ └─ExchangeSender 10000.00 mpp[tiflash] ExchangeType: HashPartition, Compression: FAST, Hash Cols: [name: test.t.a, collate: binary]", + " │ └─TableFullScan 10000.00 mpp[tiflash] table:t keep order:false, stats:pseudo", + " └─ExchangeReceiver(Probe) 10000.00 mpp[tiflash] ", + " └─ExchangeSender 10000.00 mpp[tiflash] ExchangeType: HashPartition, Compression: FAST, Hash Cols: [name: test.t.a, collate: binary]", + " └─TableFullScan 10000.00 mpp[tiflash] table:t1 keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain format = 'brief' select /*+ qb_name(qb, v12) read_from_storage(tiflash[t1@qb, t@qb]), broadcast_join(t1@qb, t@qb) */ * from v12;", + "Plan": [ + "TableReader 12500.00 root MppVersion: 2, data:ExchangeSender", + "└─ExchangeSender 12500.00 mpp[tiflash] ExchangeType: PassThrough", + " └─Projection 12500.00 mpp[tiflash] test.t.a, test.t.b", + " └─HashJoin 12500.00 mpp[tiflash] inner join, equal:[eq(test.t.a, test.t.a)]", + " ├─ExchangeReceiver(Build) 10000.00 mpp[tiflash] ", + " │ └─ExchangeSender 10000.00 mpp[tiflash] ExchangeType: Broadcast, Compression: FAST", + " │ └─TableFullScan 10000.00 mpp[tiflash] table:t keep order:false, stats:pseudo", + " └─TableFullScan(Probe) 10000.00 mpp[tiflash] table:t1 keep order:false, stats:pseudo" + ], + "Warn": null + } + ] + }, + { + "Name": "TestJoinHintCompatibility", + "Cases": [ + { + "SQL": "explain format = 'brief' select /*+ leading(t3), hash_join(t1) */ * from t1 join t2 join t3 where t1.a = t2.a and t2.b = t3.b;", + "Plan": [ + "Projection 15593.77 root test.t1.a, test.t1.b, test.t2.a, test.t2.b, test.t3.a, test.t3.b", + "└─HashJoin 15593.77 root inner join, equal:[eq(test.t2.a, test.t1.a)]", + " ├─TableReader(Build) 10000.00 root data:TableFullScan", + " │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + " └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t3.b, test.t2.b)]", + " ├─TableReader(Build) 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 keep order:false, stats:pseudo", + " └─TableReader(Probe) 9990.00 root data:Selection", + " └─Selection 9990.00 cop[tikv] not(isnull(test.t3.b))", + " └─TableFullScan 10000.00 cop[tikv] table:t3 keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain format = 'brief' select /*+ leading(t2), hash_join(t2) */ * from t1 join t2 join t3 where t1.a = t2.a and t2.b = t3.b;", + "Plan": [ + "Projection 15593.77 root test.t1.a, test.t1.b, test.t2.a, test.t2.b, test.t3.a, test.t3.b", + "└─HashJoin 15593.77 root inner join, equal:[eq(test.t2.a, test.t1.a)]", + " ├─TableReader(Build) 10000.00 root data:TableFullScan", + " │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + " └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t2.b, test.t3.b)]", + " ├─TableReader(Build) 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 keep order:false, stats:pseudo", + " └─TableReader(Probe) 9990.00 root data:Selection", + " └─Selection 9990.00 cop[tikv] not(isnull(test.t3.b))", + " └─TableFullScan 10000.00 cop[tikv] table:t3 keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain format = 'brief' select /*+ leading(t3), merge_join(t1) */ * from t1 join t2 join t3 where t1.a = t2.a and t2.b = t3.b;", + "Plan": [ + "Projection 15593.77 root test.t1.a, test.t1.b, test.t2.a, test.t2.b, test.t3.a, test.t3.b", + "└─MergeJoin 15593.77 root inner join, left key:test.t2.a, right key:test.t1.a", + " ├─Projection(Build) 10000.00 root test.t1.a, test.t1.b", + " │ └─IndexLookUp 10000.00 root ", + " │ ├─IndexFullScan(Build) 10000.00 cop[tikv] table:t1, index:idx_a(a) keep order:true, stats:pseudo", + " │ └─TableRowIDScan(Probe) 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + " └─Sort(Probe) 12475.01 root test.t2.a", + " └─HashJoin 12475.01 root inner join, equal:[eq(test.t3.b, test.t2.b)]", + " ├─TableReader(Build) 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 keep order:false, stats:pseudo", + " └─TableReader(Probe) 9990.00 root data:Selection", + " └─Selection 9990.00 cop[tikv] not(isnull(test.t3.b))", + " └─TableFullScan 10000.00 cop[tikv] table:t3 keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain format = 'brief' select /*+ leading(t2), merge_join(t2) */ * from t1 join t2 join t3 where t1.a = t2.a and t2.b = t3.b;", + "Plan": [ + "Projection 15593.77 root test.t1.a, test.t1.b, test.t2.a, test.t2.b, test.t3.a, test.t3.b", + "└─HashJoin 15593.77 root inner join, equal:[eq(test.t2.a, test.t1.a)]", + " ├─TableReader(Build) 10000.00 root data:TableFullScan", + " │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + " └─MergeJoin(Probe) 12475.01 root inner join, left key:test.t2.b, right key:test.t3.b", + " ├─Projection(Build) 9990.00 root test.t3.a, test.t3.b", + " │ └─IndexLookUp 9990.00 root ", + " │ ├─IndexFullScan(Build) 9990.00 cop[tikv] table:t3, index:idx_b(b) keep order:true, stats:pseudo", + " │ └─TableRowIDScan(Probe) 9990.00 cop[tikv] table:t3 keep order:false, stats:pseudo", + " └─Projection(Probe) 9980.01 root test.t2.a, test.t2.b", + " └─IndexLookUp 9980.01 root ", + " ├─IndexFullScan(Build) 9990.00 cop[tikv] table:t2, index:idx_b(b) keep order:true, stats:pseudo", + " └─Selection(Probe) 9980.01 cop[tikv] not(isnull(test.t2.a))", + " └─TableRowIDScan 9990.00 cop[tikv] table:t2 keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain format = 'brief' select /*+ leading(t3), inl_join(t1) */ * from t1 join t2 join t3 where t1.a = t2.a and t2.b = t3.b;", + "Plan": [ + "Projection 15593.77 root test.t1.a, test.t1.b, test.t2.a, test.t2.b, test.t3.a, test.t3.b", + "└─IndexJoin 15593.77 root inner join, inner:IndexLookUp, outer key:test.t2.a, inner key:test.t1.a, equal cond:eq(test.t2.a, test.t1.a)", + " ├─HashJoin(Build) 12475.01 root inner join, equal:[eq(test.t3.b, test.t2.b)]", + " │ ├─TableReader(Build) 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 keep order:false, stats:pseudo", + " │ └─TableReader(Probe) 9990.00 root data:Selection", + " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t3.b))", + " │ └─TableFullScan 10000.00 cop[tikv] table:t3 keep order:false, stats:pseudo", + " └─IndexLookUp(Probe) 15593.77 root ", + " ├─IndexRangeScan(Build) 15593.77 cop[tikv] table:t1, index:idx_a(a) range: decided by [eq(test.t1.a, test.t2.a)], keep order:false, stats:pseudo", + " └─TableRowIDScan(Probe) 15593.77 cop[tikv] table:t1 keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain format = 'brief' select /*+ leading(t2), inl_join(t2) */ * from t1 join t2 join t3 where t1.a = t2.a and t2.b = t3.b;", + "Plan": [ + "Projection 15593.77 root test.t1.a, test.t1.b, test.t2.a, test.t2.b, test.t3.a, test.t3.b", + "└─HashJoin 15593.77 root inner join, equal:[eq(test.t2.a, test.t1.a)]", + " ├─TableReader(Build) 10000.00 root data:TableFullScan", + " │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + " └─IndexJoin(Probe) 12475.01 root inner join, inner:IndexLookUp, outer key:test.t3.b, inner key:test.t2.b, equal cond:eq(test.t3.b, test.t2.b)", + " ├─TableReader(Build) 9990.00 root data:Selection", + " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t3.b))", + " │ └─TableFullScan 10000.00 cop[tikv] table:t3 keep order:false, stats:pseudo", + " └─IndexLookUp(Probe) 12475.01 root ", + " ├─Selection(Build) 12487.50 cop[tikv] not(isnull(test.t2.b))", + " │ └─IndexRangeScan 12500.00 cop[tikv] table:t2, index:idx_b(b) range: decided by [eq(test.t2.b, test.t3.b)], keep order:false, stats:pseudo", + " └─Selection(Probe) 12475.01 cop[tikv] not(isnull(test.t2.a))", + " └─TableRowIDScan 12487.50 cop[tikv] table:t2 keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain format = 'brief' select /*+ leading(t3), hash_join_build(t1) */ * from t1 join t2 join t3 where t1.a = t2.a and t2.b = t3.b;", + "Plan": [ + "Projection 15593.77 root test.t1.a, test.t1.b, test.t2.a, test.t2.b, test.t3.a, test.t3.b", + "└─HashJoin 15593.77 root inner join, equal:[eq(test.t2.a, test.t1.a)]", + " ├─TableReader(Build) 10000.00 root data:TableFullScan", + " │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + " └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t3.b, test.t2.b)]", + " ├─TableReader(Build) 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 keep order:false, stats:pseudo", + " └─TableReader(Probe) 9990.00 root data:Selection", + " └─Selection 9990.00 cop[tikv] not(isnull(test.t3.b))", + " └─TableFullScan 10000.00 cop[tikv] table:t3 keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain format = 'brief' select /*+ leading(t2), hash_join_build(t2) */ * from t1 join t2 join t3 where t1.a = t2.a and t2.b = t3.b;", + "Plan": [ + "Projection 15593.77 root test.t1.a, test.t1.b, test.t2.a, test.t2.b, test.t3.a, test.t3.b", + "└─HashJoin 15593.77 root inner join, equal:[eq(test.t2.a, test.t1.a)]", + " ├─TableReader(Build) 10000.00 root data:TableFullScan", + " │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + " └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t2.b, test.t3.b)]", + " ├─TableReader(Build) 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 keep order:false, stats:pseudo", + " └─TableReader(Probe) 9990.00 root data:Selection", + " └─Selection 9990.00 cop[tikv] not(isnull(test.t3.b))", + " └─TableFullScan 10000.00 cop[tikv] table:t3 keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain format = 'brief' select /*+ leading(t3), hash_join_probe(t1) */ * from t1 join t2 join t3 where t1.a = t2.a and t2.b = t3.b;", + "Plan": [ + "Projection 15593.77 root test.t1.a, test.t1.b, test.t2.a, test.t2.b, test.t3.a, test.t3.b", + "└─HashJoin 15593.77 root inner join, equal:[eq(test.t2.a, test.t1.a)]", + " ├─HashJoin(Build) 12475.01 root inner join, equal:[eq(test.t3.b, test.t2.b)]", + " │ ├─TableReader(Build) 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 keep order:false, stats:pseudo", + " │ └─TableReader(Probe) 9990.00 root data:Selection", + " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t3.b))", + " │ └─TableFullScan 10000.00 cop[tikv] table:t3 keep order:false, stats:pseudo", + " └─TableReader(Probe) 10000.00 root data:TableFullScan", + " └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain format = 'brief' select /*+ leading(t2), hash_join_probe(t2) */ * from t1 join t2 join t3 where t1.a = t2.a and t2.b = t3.b;", + "Plan": [ + "Projection 15593.77 root test.t1.a, test.t1.b, test.t2.a, test.t2.b, test.t3.a, test.t3.b", + "└─HashJoin 15593.77 root inner join, equal:[eq(test.t2.a, test.t1.a)]", + " ├─TableReader(Build) 10000.00 root data:TableFullScan", + " │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + " └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t2.b, test.t3.b)]", + " ├─TableReader(Build) 9990.00 root data:Selection", + " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t3.b))", + " │ └─TableFullScan 10000.00 cop[tikv] table:t3 keep order:false, stats:pseudo", + " └─TableReader(Probe) 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 keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain format = 'brief' select /*+ leading(t6), shuffle_join(t4) */ * from t4 join t5 join t6 where t4.a = t5.a and t5.b = t6.b;", + "Plan": [ + "TableReader 15593.77 root MppVersion: 2, data:ExchangeSender", + "└─ExchangeSender 15593.77 mpp[tiflash] ExchangeType: PassThrough", + " └─Projection 15593.77 mpp[tiflash] test.t4.a, test.t4.b, test.t5.a, test.t5.b, test.t6.a, test.t6.b", + " └─HashJoin 15593.77 mpp[tiflash] inner join, equal:[eq(test.t5.a, test.t4.a)]", + " ├─ExchangeReceiver(Build) 9990.00 mpp[tiflash] ", + " │ └─ExchangeSender 9990.00 mpp[tiflash] ExchangeType: HashPartition, Compression: FAST, Hash Cols: [name: test.t4.a, collate: binary]", + " │ └─Selection 9990.00 mpp[tiflash] not(isnull(test.t4.a))", + " │ └─TableFullScan 10000.00 mpp[tiflash] table:t4 pushed down filter:empty, keep order:false, stats:pseudo", + " └─ExchangeReceiver(Probe) 12475.01 mpp[tiflash] ", + " └─ExchangeSender 12475.01 mpp[tiflash] ExchangeType: HashPartition, Compression: FAST, Hash Cols: [name: test.t5.a, collate: binary]", + " └─HashJoin 12475.01 mpp[tiflash] inner join, equal:[eq(test.t6.b, test.t5.b)]", + " ├─ExchangeReceiver(Build) 9980.01 mpp[tiflash] ", + " │ └─ExchangeSender 9980.01 mpp[tiflash] ExchangeType: Broadcast, Compression: FAST", + " │ └─Selection 9980.01 mpp[tiflash] not(isnull(test.t5.a)), not(isnull(test.t5.b))", + " │ └─TableFullScan 10000.00 mpp[tiflash] table:t5 pushed down filter:empty, keep order:false, stats:pseudo", + " └─Selection(Probe) 9990.00 mpp[tiflash] not(isnull(test.t6.b))", + " └─TableFullScan 10000.00 mpp[tiflash] table:t6 pushed down filter:empty, keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain format = 'brief' select /*+ leading(t5), shuffle_join(t5) */ * from t4 join t5 join t6 where t4.a = t5.a and t5.b = t6.b;", + "Plan": [ + "TableReader 15593.77 root MppVersion: 2, data:ExchangeSender", + "└─ExchangeSender 15593.77 mpp[tiflash] ExchangeType: PassThrough", + " └─Projection 15593.77 mpp[tiflash] test.t4.a, test.t4.b, test.t5.a, test.t5.b, test.t6.a, test.t6.b", + " └─HashJoin 15593.77 mpp[tiflash] inner join, equal:[eq(test.t5.b, test.t6.b)]", + " ├─ExchangeReceiver(Build) 9990.00 mpp[tiflash] ", + " │ └─ExchangeSender 9990.00 mpp[tiflash] ExchangeType: Broadcast, Compression: FAST", + " │ └─Selection 9990.00 mpp[tiflash] not(isnull(test.t6.b))", + " │ └─TableFullScan 10000.00 mpp[tiflash] table:t6 pushed down filter:empty, keep order:false, stats:pseudo", + " └─HashJoin(Probe) 12475.01 mpp[tiflash] inner join, equal:[eq(test.t5.a, test.t4.a)]", + " ├─ExchangeReceiver(Build) 9980.01 mpp[tiflash] ", + " │ └─ExchangeSender 9980.01 mpp[tiflash] ExchangeType: HashPartition, Compression: FAST, Hash Cols: [name: test.t5.a, collate: binary]", + " │ └─Selection 9980.01 mpp[tiflash] not(isnull(test.t5.a)), not(isnull(test.t5.b))", + " │ └─TableFullScan 10000.00 mpp[tiflash] table:t5 pushed down filter:empty, keep order:false, stats:pseudo", + " └─ExchangeReceiver(Probe) 9990.00 mpp[tiflash] ", + " └─ExchangeSender 9990.00 mpp[tiflash] ExchangeType: HashPartition, Compression: FAST, Hash Cols: [name: test.t4.a, collate: binary]", + " └─Selection 9990.00 mpp[tiflash] not(isnull(test.t4.a))", + " └─TableFullScan 10000.00 mpp[tiflash] table:t4 pushed down filter:empty, keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain format = 'brief' select /*+ leading(t6), broadcast_join(t4) */ * from t4 join t5 join t6 where t4.a = t5.a and t5.b = t6.b;", + "Plan": [ + "TableReader 15593.77 root MppVersion: 2, data:ExchangeSender", + "└─ExchangeSender 15593.77 mpp[tiflash] ExchangeType: PassThrough", + " └─Projection 15593.77 mpp[tiflash] test.t4.a, test.t4.b, test.t5.a, test.t5.b, test.t6.a, test.t6.b", + " └─HashJoin 15593.77 mpp[tiflash] inner join, equal:[eq(test.t5.a, test.t4.a)]", + " ├─ExchangeReceiver(Build) 9990.00 mpp[tiflash] ", + " │ └─ExchangeSender 9990.00 mpp[tiflash] ExchangeType: Broadcast, Compression: FAST", + " │ └─Selection 9990.00 mpp[tiflash] not(isnull(test.t4.a))", + " │ └─TableFullScan 10000.00 mpp[tiflash] table:t4 pushed down filter:empty, keep order:false, stats:pseudo", + " └─HashJoin(Probe) 12475.01 mpp[tiflash] inner join, equal:[eq(test.t6.b, test.t5.b)]", + " ├─ExchangeReceiver(Build) 9980.01 mpp[tiflash] ", + " │ └─ExchangeSender 9980.01 mpp[tiflash] ExchangeType: Broadcast, Compression: FAST", + " │ └─Selection 9980.01 mpp[tiflash] not(isnull(test.t5.a)), not(isnull(test.t5.b))", + " │ └─TableFullScan 10000.00 mpp[tiflash] table:t5 pushed down filter:empty, keep order:false, stats:pseudo", + " └─Selection(Probe) 9990.00 mpp[tiflash] not(isnull(test.t6.b))", + " └─TableFullScan 10000.00 mpp[tiflash] table:t6 pushed down filter:empty, keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain format = 'brief' select /*+ leading(t5), broadcast_join(t5) */ * from t4 join t5 join t6 where t4.a = t5.a and t5.b = t6.b;", + "Plan": [ + "TableReader 15593.77 root MppVersion: 2, data:ExchangeSender", + "└─ExchangeSender 15593.77 mpp[tiflash] ExchangeType: PassThrough", + " └─Projection 15593.77 mpp[tiflash] test.t4.a, test.t4.b, test.t5.a, test.t5.b, test.t6.a, test.t6.b", + " └─HashJoin 15593.77 mpp[tiflash] inner join, equal:[eq(test.t5.b, test.t6.b)]", + " ├─ExchangeReceiver(Build) 9990.00 mpp[tiflash] ", + " │ └─ExchangeSender 9990.00 mpp[tiflash] ExchangeType: Broadcast, Compression: FAST", + " │ └─Selection 9990.00 mpp[tiflash] not(isnull(test.t6.b))", + " │ └─TableFullScan 10000.00 mpp[tiflash] table:t6 pushed down filter:empty, keep order:false, stats:pseudo", + " └─HashJoin(Probe) 12475.01 mpp[tiflash] inner join, equal:[eq(test.t5.a, test.t4.a)]", + " ├─ExchangeReceiver(Build) 9980.01 mpp[tiflash] ", + " │ └─ExchangeSender 9980.01 mpp[tiflash] ExchangeType: Broadcast, Compression: FAST", + " │ └─Selection 9980.01 mpp[tiflash] not(isnull(test.t5.a)), not(isnull(test.t5.b))", + " │ └─TableFullScan 10000.00 mpp[tiflash] table:t5 pushed down filter:empty, keep order:false, stats:pseudo", + " └─Selection(Probe) 9990.00 mpp[tiflash] not(isnull(test.t4.a))", + " └─TableFullScan 10000.00 mpp[tiflash] table:t4 pushed down filter:empty, keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain format = 'brief' select /*+ leading(t3), hash_join(t1) */ * from t1 join t2 on t1.a = t2.a left join t3 on t2.b = t3.b;", + "Plan": [ + "Projection 15609.38 root test.t1.a, test.t1.b, test.t2.a, test.t2.b, test.t3.a, test.t3.b", + "└─HashJoin 15609.38 root inner join, equal:[eq(test.t2.a, test.t1.a)]", + " ├─TableReader(Build) 10000.00 root data:TableFullScan", + " │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + " └─HashJoin(Probe) 12487.50 root left outer join, equal:[eq(test.t2.b, test.t3.b)]", + " ├─TableReader(Build) 9990.00 root data:Selection", + " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t3.b))", + " │ └─TableFullScan 10000.00 cop[tikv] table:t3 keep order:false, stats:pseudo", + " └─TableReader(Probe) 9990.00 root data:Selection", + " └─Selection 9990.00 cop[tikv] not(isnull(test.t2.a))", + " └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain format = 'brief' select /*+ leading(t2), hash_join(t2) */ * from t1 join t2 on t1.a = t2.a left join t3 on t2.b = t3.b;", + "Plan": [ + "Projection 15609.38 root test.t1.a, test.t1.b, test.t2.a, test.t2.b, test.t3.a, test.t3.b", + "└─HashJoin 15609.38 root inner join, equal:[eq(test.t2.a, test.t1.a)]", + " ├─TableReader(Build) 10000.00 root data:TableFullScan", + " │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + " └─HashJoin(Probe) 12487.50 root left outer join, equal:[eq(test.t2.b, test.t3.b)]", + " ├─TableReader(Build) 9990.00 root data:Selection", + " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t3.b))", + " │ └─TableFullScan 10000.00 cop[tikv] table:t3 keep order:false, stats:pseudo", + " └─TableReader(Probe) 9990.00 root data:Selection", + " └─Selection 9990.00 cop[tikv] not(isnull(test.t2.a))", + " └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain format = 'brief' select /*+ leading(t3), merge_join(t1) */ * from t1 right join t2 on t1.a = t2.a join t3 on t2.b = t3.b;", + "Plan": [ + "Projection 15609.38 root test.t1.a, test.t1.b, test.t2.a, test.t2.b, test.t3.a, test.t3.b", + "└─MergeJoin 15609.38 root right outer join, left key:test.t1.a, right key:test.t2.a", + " ├─Projection(Build) 10000.00 root test.t1.a, test.t1.b", + " │ └─IndexLookUp 10000.00 root ", + " │ ├─IndexFullScan(Build) 10000.00 cop[tikv] table:t1, index:idx_a(a) keep order:true, stats:pseudo", + " │ └─TableRowIDScan(Probe) 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + " └─Sort(Probe) 12487.50 root test.t2.a", + " └─HashJoin 12487.50 root inner join, equal:[eq(test.t3.b, test.t2.b)]", + " ├─TableReader(Build) 9990.00 root data:Selection", + " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", + " │ └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo", + " └─TableReader(Probe) 9990.00 root data:Selection", + " └─Selection 9990.00 cop[tikv] not(isnull(test.t3.b))", + " └─TableFullScan 10000.00 cop[tikv] table:t3 keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain format = 'brief' select /*+ leading(t2), merge_join(t2) */ * from t1 right join t2 on t1.a = t2.a join t3 on t2.b = t3.b;", + "Plan": [ + "HashJoin 15609.38 root right outer join, equal:[eq(test.t1.a, test.t2.a)]", + "├─TableReader(Build) 10000.00 root data:TableFullScan", + "│ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + "└─MergeJoin(Probe) 12487.50 root inner join, left key:test.t2.b, right key:test.t3.b", + " ├─Projection(Build) 9990.00 root test.t3.a, test.t3.b", + " │ └─IndexLookUp 9990.00 root ", + " │ ├─IndexFullScan(Build) 9990.00 cop[tikv] table:t3, index:idx_b(b) keep order:true, stats:pseudo", + " │ └─TableRowIDScan(Probe) 9990.00 cop[tikv] table:t3 keep order:false, stats:pseudo", + " └─Projection(Probe) 9990.00 root test.t2.a, test.t2.b", + " └─IndexLookUp 9990.00 root ", + " ├─IndexFullScan(Build) 9990.00 cop[tikv] table:t2, index:idx_b(b) keep order:true, stats:pseudo", + " └─TableRowIDScan(Probe) 9990.00 cop[tikv] table:t2 keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain format = 'brief' select /*+ leading(t3), inl_join(t1) */ * from t1 join t2 on t1.a = t2.a straight_join t3 on t2.b = t3.b;", + "Plan": [ + "HashJoin 15593.77 root inner join, equal:[eq(test.t2.b, test.t3.b)]", + "├─TableReader(Build) 9990.00 root data:Selection", + "│ └─Selection 9990.00 cop[tikv] not(isnull(test.t3.b))", + "│ └─TableFullScan 10000.00 cop[tikv] table:t3 keep order:false, stats:pseudo", + "└─Projection(Probe) 12475.01 root test.t1.a, test.t1.b, test.t2.a, test.t2.b", + " └─IndexJoin 12475.01 root inner join, inner:IndexLookUp, outer key:test.t2.a, inner key:test.t1.a, equal cond:eq(test.t2.a, test.t1.a)", + " ├─TableReader(Build) 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 keep order:false, stats:pseudo", + " └─IndexLookUp(Probe) 12475.01 root ", + " ├─IndexRangeScan(Build) 12475.01 cop[tikv] table:t1, index:idx_a(a) range: decided by [eq(test.t1.a, test.t2.a)], keep order:false, stats:pseudo", + " └─TableRowIDScan(Probe) 12475.01 cop[tikv] table:t1 keep order:false, stats:pseudo" + ], + "Warn": [ + "[planner:1815]leading hint is inapplicable, check the join type or the join algorithm hint" + ] + }, + { + "SQL": "explain format = 'brief' select /*+ leading(t2), inl_join(t2) */ * from t1 join t2 on t1.a = t2.a straight_join t3 on t2.b = t3.b;", + "Plan": [ + "HashJoin 15593.77 root inner join, equal:[eq(test.t2.b, test.t3.b)]", + "├─TableReader(Build) 9990.00 root data:Selection", + "│ └─Selection 9990.00 cop[tikv] not(isnull(test.t3.b))", + "│ └─TableFullScan 10000.00 cop[tikv] table:t3 keep order:false, stats:pseudo", + "└─Projection(Probe) 12475.01 root test.t1.a, test.t1.b, test.t2.a, test.t2.b", + " └─IndexJoin 12475.01 root inner join, inner:IndexLookUp, outer key:test.t1.a, inner key:test.t2.a, equal cond:eq(test.t1.a, test.t2.a)", + " ├─TableReader(Build) 10000.00 root data:TableFullScan", + " │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + " └─IndexLookUp(Probe) 12475.01 root ", + " ├─Selection(Build) 12487.50 cop[tikv] not(isnull(test.t2.a))", + " │ └─IndexRangeScan 12500.00 cop[tikv] table:t2, index:idx_a(a) range: decided by [eq(test.t2.a, test.t1.a)], keep order:false, stats:pseudo", + " └─Selection(Probe) 12475.01 cop[tikv] not(isnull(test.t2.b))", + " └─TableRowIDScan 12487.50 cop[tikv] table:t2 keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain format = 'brief' select /*+ leading(t3), hash_join_build(t1) */ * from t1 cross join t2 on t1.a = t2.a join t3 on t2.b = t3.b;", + "Plan": [ + "Projection 15593.77 root test.t1.a, test.t1.b, test.t2.a, test.t2.b, test.t3.a, test.t3.b", + "└─HashJoin 15593.77 root inner join, equal:[eq(test.t2.a, test.t1.a)]", + " ├─TableReader(Build) 10000.00 root data:TableFullScan", + " │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + " └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t3.b, test.t2.b)]", + " ├─TableReader(Build) 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 keep order:false, stats:pseudo", + " └─TableReader(Probe) 9990.00 root data:Selection", + " └─Selection 9990.00 cop[tikv] not(isnull(test.t3.b))", + " └─TableFullScan 10000.00 cop[tikv] table:t3 keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain format = 'brief' select /*+ leading(t2), hash_join_probe(t2) */ * from t1 cross join t2 on t1.a = t2.a join t3 on t2.b = t3.b;", + "Plan": [ + "Projection 15593.77 root test.t1.a, test.t1.b, test.t2.a, test.t2.b, test.t3.a, test.t3.b", + "└─HashJoin 15593.77 root inner join, equal:[eq(test.t2.a, test.t1.a)]", + " ├─TableReader(Build) 10000.00 root data:TableFullScan", + " │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + " └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t2.b, test.t3.b)]", + " ├─TableReader(Build) 9990.00 root data:Selection", + " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t3.b))", + " │ └─TableFullScan 10000.00 cop[tikv] table:t3 keep order:false, stats:pseudo", + " └─TableReader(Probe) 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 keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain format = 'brief' select * from v", + "Plan": [ + "HashJoin 15609.38 root inner join, equal:[eq(test.t1.a, test.t.a)]", + "├─IndexReader(Build) 10000.00 root index:IndexFullScan", + "│ └─IndexFullScan 10000.00 cop[tikv] table:t, index:idx_a(a) keep order:false, stats:pseudo", + "└─IndexJoin(Probe) 12487.50 root inner join, inner:IndexLookUp, outer key:test.t2.b, inner key:test.t1.b, equal cond:eq(test.t2.b, test.t1.b)", + " ├─IndexReader(Build) 9990.00 root index:IndexFullScan", + " │ └─IndexFullScan 9990.00 cop[tikv] table:t2, index:idx_b(b) keep order:false, stats:pseudo", + " └─IndexLookUp(Probe) 12487.50 root ", + " ├─Selection(Build) 12487.50 cop[tikv] not(isnull(test.t1.b))", + " │ └─IndexRangeScan 12500.00 cop[tikv] table:t1, index:idx_b(b) range: decided by [eq(test.t1.b, test.t2.b)], keep order:false, stats:pseudo", + " └─TableRowIDScan(Probe) 12487.50 cop[tikv] table:t1 keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain format = 'brief' select * from v1", + "Plan": [ + "MergeJoin 15609.38 root inner join, left key:test.t1.a, right key:test.t.a", + "├─IndexReader(Build) 10000.00 root index:IndexFullScan", + "│ └─IndexFullScan 10000.00 cop[tikv] table:t, index:idx_a(a) keep order:true, stats:pseudo", + "└─Sort(Probe) 12487.50 root test.t1.a", + " └─HashJoin 12487.50 root inner join, equal:[eq(test.t2.b, test.t1.b)]", + " ├─IndexReader(Build) 9990.00 root index:IndexFullScan", + " │ └─IndexFullScan 9990.00 cop[tikv] table:t2, index:idx_b(b) keep order:false, stats:pseudo", + " └─TableReader(Probe) 9990.00 root data:Selection", + " └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", + " └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain format = 'brief' select /*+ qb_name(qb, v2), leading(t2@qb), merge_join(t@qb) */ * from v2", + "Plan": [ + "MergeJoin 15609.38 root inner join, left key:test.t1.a, right key:test.t.a", + "├─IndexReader(Build) 10000.00 root index:IndexFullScan", + "│ └─IndexFullScan 10000.00 cop[tikv] table:t, index:idx_a(a) keep order:true, stats:pseudo", + "└─Sort(Probe) 12487.50 root test.t1.a", + " └─HashJoin 12487.50 root inner join, equal:[eq(test.t2.b, test.t1.b)]", + " ├─IndexReader(Build) 9990.00 root index:IndexFullScan", + " │ └─IndexFullScan 9990.00 cop[tikv] table:t2, index:idx_b(b) keep order:false, stats:pseudo", + " └─TableReader(Probe) 9990.00 root data:Selection", + " └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", + " └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain format = 'brief' select /*+ qb_name(qb, v2), leading(t1@qb), inl_join(t1@qb) */ * from v2", + "Plan": [ + "HashJoin 15609.38 root inner join, equal:[eq(test.t1.a, test.t.a)]", + "├─IndexReader(Build) 10000.00 root index:IndexFullScan", + "│ └─IndexFullScan 10000.00 cop[tikv] table:t, index:idx_a(a) keep order:false, stats:pseudo", + "└─IndexJoin(Probe) 12487.50 root inner join, inner:IndexLookUp, outer key:test.t2.b, inner key:test.t1.b, equal cond:eq(test.t2.b, test.t1.b)", + " ├─IndexReader(Build) 9990.00 root index:IndexFullScan", + " │ └─IndexFullScan 9990.00 cop[tikv] table:t2, index:idx_b(b) keep order:false, stats:pseudo", + " └─IndexLookUp(Probe) 12487.50 root ", + " ├─Selection(Build) 12487.50 cop[tikv] not(isnull(test.t1.b))", + " │ └─IndexRangeScan 12500.00 cop[tikv] table:t1, index:idx_b(b) range: decided by [eq(test.t1.b, test.t2.b)], keep order:false, stats:pseudo", + " └─TableRowIDScan(Probe) 12487.50 cop[tikv] table:t1 keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain with tt as (select /*+ leading(t3), merge_join(t1) */ t1.a from t1 join t2 join t3 where t1.a = t2.a and t2.b=t3.b) select * from tt t1 join tt t2 on t1.a=t2.a", + "Plan": [ + "HashJoin_113 24316.55 root inner join, equal:[eq(test.t1.a, test.t1.a)]", + "├─Selection_117(Build) 12475.01 root not(isnull(test.t1.a))", + "│ └─CTEFullScan_118 15593.77 root CTE:tt AS t2 data:CTE_0", + "└─Selection_115(Probe) 12475.01 root not(isnull(test.t1.a))", + " └─CTEFullScan_116 15593.77 root CTE:tt AS t1 data:CTE_0", + "CTE_0 15593.77 root Non-Recursive CTE", + "└─MergeJoin_22(Seed Part) 15593.77 root inner join, left key:test.t2.a, right key:test.t1.a", + " ├─IndexReader_110(Build) 10000.00 root index:IndexFullScan_109", + " │ └─IndexFullScan_109 10000.00 cop[tikv] table:t1, index:idx_a(a) keep order:true, stats:pseudo", + " └─Sort_108(Probe) 12475.01 root test.t2.a", + " └─HashJoin_81 12475.01 root inner join, equal:[eq(test.t3.b, test.t2.b)]", + " ├─IndexReader_91(Build) 9990.00 root index:IndexFullScan_90", + " │ └─IndexFullScan_90 9990.00 cop[tikv] table:t3, index:idx_b(b) keep order:false, stats:pseudo", + " └─TableReader_96(Probe) 9980.01 root data:Selection_95", + " └─Selection_95 9980.01 cop[tikv] not(isnull(test.t2.a)), not(isnull(test.t2.b))", + " └─TableFullScan_94 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain with tt as (select /*+ leading(t2), inl_join(t2) */ t1.a from t1 join t2 join t3 where t1.a = t2.a and t2.b=t3.b) select * from tt t1 join tt t2 on t1.a=t2.a", + "Plan": [ + "HashJoin_112 24316.55 root inner join, equal:[eq(test.t1.a, test.t1.a)]", + "├─Selection_116(Build) 12475.01 root not(isnull(test.t1.a))", + "│ └─CTEFullScan_117 15593.77 root CTE:tt AS t2 data:CTE_0", + "└─Selection_114(Probe) 12475.01 root not(isnull(test.t1.a))", + " └─CTEFullScan_115 15593.77 root CTE:tt AS t1 data:CTE_0", + "CTE_0 15593.77 root Non-Recursive CTE", + "└─HashJoin_32(Seed Part) 15593.77 root inner join, equal:[eq(test.t2.a, test.t1.a)]", + " ├─IndexReader_109(Build) 10000.00 root index:IndexFullScan_108", + " │ └─IndexFullScan_108 10000.00 cop[tikv] table:t1, index:idx_a(a) keep order:false, stats:pseudo", + " └─IndexJoin_95(Probe) 12475.01 root inner join, inner:IndexLookUp_94, outer key:test.t3.b, inner key:test.t2.b, equal cond:eq(test.t3.b, test.t2.b)", + " ├─IndexReader_74(Build) 9990.00 root index:IndexFullScan_73", + " │ └─IndexFullScan_73 9990.00 cop[tikv] table:t3, index:idx_b(b) keep order:false, stats:pseudo", + " └─IndexLookUp_94(Probe) 12475.01 root ", + " ├─Selection_92(Build) 12487.50 cop[tikv] not(isnull(test.t2.b))", + " │ └─IndexRangeScan_90 12500.00 cop[tikv] table:t2, index:idx_b(b) range: decided by [eq(test.t2.b, test.t3.b)], keep order:false, stats:pseudo", + " └─Selection_93(Probe) 12475.01 cop[tikv] not(isnull(test.t2.a))", + " └─TableRowIDScan_91 12487.50 cop[tikv] table:t2 keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain with tt as (select /*+ merge(), leading(t3), inl_join(t1) */ t1.a from t1 join t2 join t3 where t1.a = t2.a and t2.b=t3.b) select * from tt t1 join tt t2 on t1.a=t2.a", + "Plan": [ + "HashJoin_48 30395.69 root inner join, equal:[eq(test.t2.b, test.t3.b)]", + "├─IndexReader_169(Build) 9990.00 root index:IndexFullScan_168", + "│ └─IndexFullScan_168 9990.00 cop[tikv] table:t3, index:idx_b(b) keep order:false, stats:pseudo", + "└─HashJoin_68(Probe) 24316.55 root inner join, equal:[eq(test.t1.a, test.t2.a)]", + " ├─TableReader_159(Build) 9980.01 root data:Selection_158", + " │ └─Selection_158 9980.01 cop[tikv] not(isnull(test.t2.a)), not(isnull(test.t2.b))", + " │ └─TableFullScan_157 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo", + " └─IndexJoin_150(Probe) 19492.21 root inner join, inner:IndexReader_149, outer key:test.t1.a, inner key:test.t1.a, equal cond:eq(test.t1.a, test.t1.a)", + " ├─IndexJoin_84(Build) 15593.77 root inner join, inner:IndexReader_83, outer key:test.t2.a, inner key:test.t1.a, equal cond:eq(test.t2.a, test.t1.a)", + " │ ├─HashJoin_119(Build) 12475.01 root inner join, equal:[eq(test.t2.b, test.t3.b)]", + " │ │ ├─IndexReader_140(Build) 9990.00 root index:IndexFullScan_139", + " │ │ │ └─IndexFullScan_139 9990.00 cop[tikv] table:t3, index:idx_b(b) keep order:false, stats:pseudo", + " │ │ └─TableReader_130(Probe) 9980.01 root data:Selection_129", + " │ │ └─Selection_129 9980.01 cop[tikv] not(isnull(test.t2.a)), not(isnull(test.t2.b))", + " │ │ └─TableFullScan_128 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo", + " │ └─IndexReader_83(Probe) 15593.77 root index:IndexRangeScan_82", + " │ └─IndexRangeScan_82 15593.77 cop[tikv] table:t1, index:idx_a(a) range: decided by [eq(test.t1.a, test.t2.a)], keep order:false, stats:pseudo", + " └─IndexReader_149(Probe) 19492.21 root index:IndexRangeScan_148", + " └─IndexRangeScan_148 19492.21 cop[tikv] table:t1, index:idx_a(a) range: decided by [eq(test.t1.a, test.t1.a)], keep order:false, stats:pseudo" + ], + "Warn": [ + "[planner:1815]We can only use one leading hint at most, when multiple leading hints are used, all leading hints will be invalid", + "[planner:1815]There are no matching table names for (t1) in optimizer hint /*+ INL_JOIN(t1, t1) */ or /*+ TIDB_INLJ(t1, t1) */. Maybe you can use the table alias name", + "[planner:1815]We can only use one leading hint at most, when multiple leading hints are used, all leading hints will be invalid", + "[planner:1815]There are no matching table names for (t1, t1) in optimizer hint /*+ INL_JOIN(t1, t1, t1) */ or /*+ TIDB_INLJ(t1, t1, t1) */. Maybe you can use the table alias name" + ] + }, + { + "SQL": "explain with tt as (select /*+ leading(t2), merge_join(t2), merge() */ t1.a from t1 join t2 join t3 where t1.a = t2.a and t2.b=t3.b) select * from tt t1 join tt t2 on t1.a=t2.a", + "Plan": [ + "HashJoin_48 30395.69 root inner join, equal:[eq(test.t2.b, test.t3.b)]", + "├─IndexReader_145(Build) 9990.00 root index:IndexFullScan_144", + "│ └─IndexFullScan_144 9990.00 cop[tikv] table:t3, index:idx_b(b) keep order:false, stats:pseudo", + "└─MergeJoin_142(Probe) 24316.55 root inner join, left key:test.t1.a, right key:test.t2.a", + " ├─Projection_92(Build) 9980.01 root test.t2.a, test.t2.b", + " │ └─IndexLookUp_91 9980.01 root ", + " │ ├─IndexFullScan_88(Build) 9990.00 cop[tikv] table:t2, index:idx_a(a) keep order:true, stats:pseudo", + " │ └─Selection_90(Probe) 9980.01 cop[tikv] not(isnull(test.t2.b))", + " │ └─TableRowIDScan_89 9990.00 cop[tikv] table:t2 keep order:false, stats:pseudo", + " └─MergeJoin_53(Probe) 19492.21 root inner join, left key:test.t1.a, right key:test.t1.a", + " ├─IndexReader_87(Build) 10000.00 root index:IndexFullScan_86", + " │ └─IndexFullScan_86 10000.00 cop[tikv] table:t1, index:idx_a(a) keep order:true, stats:pseudo", + " └─MergeJoin_54(Probe) 15593.77 root inner join, left key:test.t2.a, right key:test.t1.a", + " ├─IndexReader_85(Build) 10000.00 root index:IndexFullScan_84", + " │ └─IndexFullScan_84 10000.00 cop[tikv] table:t1, index:idx_a(a) keep order:true, stats:pseudo", + " └─Sort_75(Probe) 12475.01 root test.t2.a", + " └─MergeJoin_66 12475.01 root inner join, left key:test.t2.b, right key:test.t3.b", + " ├─IndexReader_74(Build) 9990.00 root index:IndexFullScan_73", + " │ └─IndexFullScan_73 9990.00 cop[tikv] table:t3, index:idx_b(b) keep order:true, stats:pseudo", + " └─Projection_72(Probe) 9980.01 root test.t2.a, test.t2.b", + " └─IndexLookUp_71 9980.01 root ", + " ├─IndexFullScan_68(Build) 9990.00 cop[tikv] table:t2, index:idx_b(b) keep order:true, stats:pseudo", + " └─Selection_70(Probe) 9980.01 cop[tikv] not(isnull(test.t2.a))", + " └─TableRowIDScan_69 9990.00 cop[tikv] table:t2 keep order:false, stats:pseudo" + ], + "Warn": [ + "[planner:1815]We can only use one leading hint at most, when multiple leading hints are used, all leading hints will be invalid", + "[planner:1815]There are no matching table names for (t2) in optimizer hint /*+ MERGE_JOIN(t2, t2) */ or /*+ TIDB_SMJ(t2, t2) */. Maybe you can use the table alias name", + "[planner:1815]We can only use one leading hint at most, when multiple leading hints are used, all leading hints will be invalid", + "[planner:1815]There are no matching table names for (t2, t2) in optimizer hint /*+ MERGE_JOIN(t2, t2, t2) */ or /*+ TIDB_SMJ(t2, t2, t2) */. Maybe you can use the table alias name" + ] + }, + { + "SQL": "explain format = 'brief' SELECT /*+ leading(t2@sel_2), merge_join(t) */ * FROM t join t1 on t.a = t1.a WHERE EXISTS (SELECT 1 FROM t2 WHERE t2.b = t1.b);", + "Plan": [ + "HashJoin 9990.00 root semi join, equal:[eq(test.t1.b, test.t2.b)]", + "├─IndexReader(Build) 9990.00 root index:IndexFullScan", + "│ └─IndexFullScan 9990.00 cop[tikv] table:t2, index:idx_b(b) keep order:false, stats:pseudo", + "└─Projection(Probe) 12487.50 root test.t.a, test.t.b, test.t1.a, test.t1.b", + " └─MergeJoin 12487.50 root inner join, left key:test.t1.a, right key:test.t.a", + " ├─Projection(Build) 10000.00 root test.t.a, test.t.b", + " │ └─IndexLookUp 10000.00 root ", + " │ ├─IndexFullScan(Build) 10000.00 cop[tikv] table:t, index:idx_a(a) keep order:true, stats:pseudo", + " │ └─TableRowIDScan(Probe) 10000.00 cop[tikv] table:t keep order:false, stats:pseudo", + " └─Projection(Probe) 9990.00 root test.t1.a, test.t1.b", + " └─IndexLookUp 9990.00 root ", + " ├─IndexFullScan(Build) 10000.00 cop[tikv] table:t1, index:idx_a(a) keep order:true, stats:pseudo", + " └─Selection(Probe) 9990.00 cop[tikv] not(isnull(test.t1.b))", + " └─TableRowIDScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo" + ], + "Warn": [ + "[planner:1815]leading hint is inapplicable, check the join type or the join algorithm hint" + ] + }, + { + "SQL": "explain format = 'brief' SELECT /*+ leading(t1), inl_join(t1) */ * FROM t join t1 on t.a = t1.a WHERE EXISTS (SELECT 1 FROM t2 WHERE t2.b = t1.b);", + "Plan": [ + "HashJoin 9990.00 root semi join, equal:[eq(test.t1.b, test.t2.b)]", + "├─IndexReader(Build) 9990.00 root index:IndexFullScan", + "│ └─IndexFullScan 9990.00 cop[tikv] table:t2, index:idx_b(b) keep order:false, stats:pseudo", + "└─Projection(Probe) 12487.50 root test.t.a, test.t.b, test.t1.a, test.t1.b", + " └─IndexJoin 12487.50 root inner join, inner:IndexLookUp, outer key:test.t.a, inner key:test.t1.a, equal cond:eq(test.t.a, test.t1.a)", + " ├─TableReader(Build) 10000.00 root data:TableFullScan", + " │ └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo", + " └─IndexLookUp(Probe) 12487.50 root ", + " ├─IndexRangeScan(Build) 12500.00 cop[tikv] table:t1, index:idx_a(a) range: decided by [eq(test.t1.a, test.t.a)], keep order:false, stats:pseudo", + " └─Selection(Probe) 12487.50 cop[tikv] not(isnull(test.t1.b))", + " └─TableRowIDScan 12500.00 cop[tikv] table:t1 keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain format = 'brief' SELECT /*+ leading(t2@sel_2), merge_join(t) */ * FROM t join t1 on t.a = t1.a WHERE EXISTS (SELECT /*+ SEMI_JOIN_REWRITE() */ 1 FROM t2 WHERE t2.b = t1.b);", + "Plan": [ + "Projection 12487.50 root test.t.a, test.t.b, test.t1.a, test.t1.b", + "└─MergeJoin 12487.50 root inner join, left key:test.t1.a, right key:test.t.a", + " ├─Projection(Build) 10000.00 root test.t.a, test.t.b", + " │ └─IndexLookUp 10000.00 root ", + " │ ├─IndexFullScan(Build) 10000.00 cop[tikv] table:t, index:idx_a(a) keep order:true, stats:pseudo", + " │ └─TableRowIDScan(Probe) 10000.00 cop[tikv] table:t keep order:false, stats:pseudo", + " └─Sort(Probe) 9990.00 root test.t1.a", + " └─HashJoin 9990.00 root inner join, equal:[eq(test.t2.b, test.t1.b)]", + " ├─StreamAgg(Build) 7992.00 root group by:test.t2.b, funcs:firstrow(test.t2.b)->test.t2.b", + " │ └─IndexReader 7992.00 root index:StreamAgg", + " │ └─StreamAgg 7992.00 cop[tikv] group by:test.t2.b, ", + " │ └─IndexFullScan 9990.00 cop[tikv] table:t2, index:idx_b(b) keep order:true, stats:pseudo", + " └─TableReader(Probe) 9990.00 root data:Selection", + " └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", + " └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain format = 'brief' SELECT /*+ leading(t1), inl_join(t1) */ * FROM t join t1 on t.a = t1.a WHERE EXISTS (SELECT /*+ SEMI_JOIN_REWRITE() */ 1 FROM t2 WHERE t2.b = t1.b);", + "Plan": [ + "Projection 12487.50 root test.t.a, test.t.b, test.t1.a, test.t1.b", + "└─HashJoin 12487.50 root inner join, equal:[eq(test.t1.b, test.t2.b)]", + " ├─StreamAgg(Build) 7992.00 root group by:test.t2.b, funcs:firstrow(test.t2.b)->test.t2.b", + " │ └─IndexReader 7992.00 root index:StreamAgg", + " │ └─StreamAgg 7992.00 cop[tikv] group by:test.t2.b, ", + " │ └─IndexFullScan 9990.00 cop[tikv] table:t2, index:idx_b(b) keep order:true, stats:pseudo", + " └─IndexJoin(Probe) 12487.50 root inner join, inner:IndexLookUp, outer key:test.t.a, inner key:test.t1.a, equal cond:eq(test.t.a, test.t1.a)", + " ├─TableReader(Build) 10000.00 root data:TableFullScan", + " │ └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo", + " └─IndexLookUp(Probe) 12487.50 root ", + " ├─IndexRangeScan(Build) 12500.00 cop[tikv] table:t1, index:idx_a(a) range: decided by [eq(test.t1.a, test.t.a)], keep order:false, stats:pseudo", + " └─Selection(Probe) 12487.50 cop[tikv] not(isnull(test.t1.b))", + " └─TableRowIDScan 12500.00 cop[tikv] table:t1 keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain format = 'brief' select /*+ leading(t2@sel_2) merge_join(t) */ * from t join t1 on t.a = t1.a where t1.a < (select sum(t2.a) from t2 where t2.b = t1.b);", + "Plan": [ + "Projection 12487.50 root test.t.a, test.t.b, test.t1.a, test.t1.b", + "└─HashJoin 12487.50 root inner join, equal:[eq(test.t1.b, test.t2.b)], other cond:lt(cast(test.t1.a, decimal(10,0) BINARY), Column#10)", + " ├─HashAgg(Build) 7992.00 root group by:test.t2.b, funcs:sum(Column#24)->Column#10, funcs:firstrow(test.t2.b)->test.t2.b", + " │ └─TableReader 7992.00 root data:HashAgg", + " │ └─HashAgg 7992.00 cop[tikv] group by:test.t2.b, funcs:sum(test.t2.a)->Column#24", + " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", + " │ └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo", + " └─MergeJoin(Probe) 12487.50 root inner join, left key:test.t1.a, right key:test.t.a", + " ├─Projection(Build) 10000.00 root test.t.a, test.t.b", + " │ └─IndexLookUp 10000.00 root ", + " │ ├─IndexFullScan(Build) 10000.00 cop[tikv] table:t, index:idx_a(a) keep order:true, stats:pseudo", + " │ └─TableRowIDScan(Probe) 10000.00 cop[tikv] table:t keep order:false, stats:pseudo", + " └─Projection(Probe) 9990.00 root test.t1.a, test.t1.b", + " └─IndexLookUp 9990.00 root ", + " ├─IndexFullScan(Build) 10000.00 cop[tikv] table:t1, index:idx_a(a) keep order:true, stats:pseudo", + " └─Selection(Probe) 9990.00 cop[tikv] not(isnull(test.t1.b))", + " └─TableRowIDScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo" + ], + "Warn": [ + "[planner:1815]There are no matching table names for (t2) in optimizer hint /*+ LEADING(t2) */. Maybe you can use the table alias name" + ] + }, + { + "SQL": "explain format = 'brief' select /*+ leading(t1), inl_join(t1) */ * from t join t1 on t.a = t1.a where t1.a < (select sum(t2.a) from t2 where t2.b = t1.b);", + "Plan": [ + "Projection 12487.50 root test.t.a, test.t.b, test.t1.a, test.t1.b", + "└─HashJoin 12487.50 root inner join, equal:[eq(test.t1.b, test.t2.b)], other cond:lt(cast(test.t1.a, decimal(10,0) BINARY), Column#10)", + " ├─HashAgg(Build) 7992.00 root group by:test.t2.b, funcs:sum(Column#28)->Column#10, funcs:firstrow(test.t2.b)->test.t2.b", + " │ └─TableReader 7992.00 root data:HashAgg", + " │ └─HashAgg 7992.00 cop[tikv] group by:test.t2.b, funcs:sum(test.t2.a)->Column#28", + " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", + " │ └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo", + " └─IndexJoin(Probe) 12487.50 root inner join, inner:IndexLookUp, outer key:test.t.a, inner key:test.t1.a, equal cond:eq(test.t.a, test.t1.a)", + " ├─TableReader(Build) 10000.00 root data:TableFullScan", + " │ └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo", + " └─IndexLookUp(Probe) 12487.50 root ", + " ├─IndexRangeScan(Build) 12500.00 cop[tikv] table:t1, index:idx_a(a) range: decided by [eq(test.t1.a, test.t.a)], keep order:false, stats:pseudo", + " └─Selection(Probe) 12487.50 cop[tikv] not(isnull(test.t1.b))", + " └─TableRowIDScan 12500.00 cop[tikv] table:t1 keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain format = 'brief' select /*+leading(t2@sel_2) merge_join(t) */ * from t join t1 on t.a = t1.a where t1.a < (select /*+ NO_DECORRELATE() */ sum(t2.a) from t2 where t2.b = t1.b);", + "Plan": [ + "Projection 12500.00 root test.t.a, test.t.b, test.t1.a, test.t1.b", + "└─Apply 12500.00 root CARTESIAN inner join, other cond:lt(cast(test.t1.a, decimal(10,0) BINARY), Column#10)", + " ├─MergeJoin(Build) 12500.00 root inner join, left key:test.t.a, right key:test.t1.a", + " │ ├─Projection(Build) 10000.00 root test.t1.a, test.t1.b", + " │ │ └─IndexLookUp 10000.00 root ", + " │ │ ├─IndexFullScan(Build) 10000.00 cop[tikv] table:t1, index:idx_a(a) keep order:true, stats:pseudo", + " │ │ └─TableRowIDScan(Probe) 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + " │ └─Projection(Probe) 10000.00 root test.t.a, test.t.b", + " │ └─IndexLookUp 10000.00 root ", + " │ ├─IndexFullScan(Build) 10000.00 cop[tikv] table:t, index:idx_a(a) keep order:true, stats:pseudo", + " │ └─TableRowIDScan(Probe) 10000.00 cop[tikv] table:t keep order:false, stats:pseudo", + " └─MaxOneRow(Probe) 12500.00 root ", + " └─StreamAgg 12500.00 root funcs:sum(Column#25)->Column#10", + " └─Projection 125000.00 root cast(test.t2.a, decimal(10,0) BINARY)->Column#25", + " └─IndexLookUp 125000.00 root ", + " ├─IndexRangeScan(Build) 125000.00 cop[tikv] table:t2, index:idx_b(b) range: decided by [eq(test.t2.b, test.t1.b)], keep order:false, stats:pseudo", + " └─TableRowIDScan(Probe) 125000.00 cop[tikv] table:t2 keep order:false, stats:pseudo" + ], + "Warn": [ + "[planner:1815]There are no matching table names for (t2) in optimizer hint /*+ LEADING(t2) */. Maybe you can use the table alias name" + ] + }, + { + "SQL": "explain format = 'brief' select /*+ leading(t1), inl_join(t1) */ * from t join t1 on t.a = t1.a where t1.a < (select /*+ NO_DECORRELATE() */ sum(t2.a) from t2 where t2.b = t1.b);", + "Plan": [ + "Projection 12500.00 root test.t.a, test.t.b, test.t1.a, test.t1.b", + "└─Apply 12500.00 root CARTESIAN inner join, other cond:lt(cast(test.t1.a, decimal(10,0) BINARY), Column#10)", + " ├─Projection(Build) 12500.00 root test.t.a, test.t.b, test.t1.a, test.t1.b", + " │ └─IndexJoin 12500.00 root inner join, inner:IndexLookUp, outer key:test.t.a, inner key:test.t1.a, equal cond:eq(test.t.a, test.t1.a)", + " │ ├─TableReader(Build) 10000.00 root data:TableFullScan", + " │ │ └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo", + " │ └─IndexLookUp(Probe) 12500.00 root ", + " │ ├─IndexRangeScan(Build) 12500.00 cop[tikv] table:t1, index:idx_a(a) range: decided by [eq(test.t1.a, test.t.a)], keep order:false, stats:pseudo", + " │ └─TableRowIDScan(Probe) 12500.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + " └─MaxOneRow(Probe) 12500.00 root ", + " └─StreamAgg 12500.00 root funcs:sum(Column#23)->Column#10", + " └─Projection 125000.00 root cast(test.t2.a, decimal(10,0) BINARY)->Column#23", + " └─IndexLookUp 125000.00 root ", + " ├─IndexRangeScan(Build) 125000.00 cop[tikv] table:t2, index:idx_b(b) range: decided by [eq(test.t2.b, test.t1.b)], keep order:false, stats:pseudo", + " └─TableRowIDScan(Probe) 125000.00 cop[tikv] table:t2 keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain format = 'brief' select /*+ leading(t9), hash_join(t7) */ * from t7 join t8 join t9 where t7.a = t8.a and t8.b = t9.b;", + "Plan": [ + "Projection 15593.77 root test.t7.a, test.t7.b, test.t8.a, test.t8.b, test.t9.a, test.t9.b", + "└─HashJoin 15593.77 root inner join, equal:[eq(test.t8.a, test.t7.a)]", + " ├─TableReader(Build) 9990.00 root partition:all data:Selection", + " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t7.a))", + " │ └─TableFullScan 10000.00 cop[tikv] table:t7 keep order:false, stats:pseudo", + " └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t9.b, test.t8.b)]", + " ├─TableReader(Build) 9980.01 root partition:all data:Selection", + " │ └─Selection 9980.01 cop[tikv] not(isnull(test.t8.a)), not(isnull(test.t8.b))", + " │ └─TableFullScan 10000.00 cop[tikv] table:t8 keep order:false, stats:pseudo", + " └─TableReader(Probe) 9990.00 root partition:all data:Selection", + " └─Selection 9990.00 cop[tikv] not(isnull(test.t9.b))", + " └─TableFullScan 10000.00 cop[tikv] table:t9 keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain format = 'brief' select /*+ leading(t8), hash_join(t8) */ * from t7 join t8 join t9 where t7.a = t8.a and t8.b = t9.b;", + "Plan": [ + "Projection 15593.77 root test.t7.a, test.t7.b, test.t8.a, test.t8.b, test.t9.a, test.t9.b", + "└─HashJoin 15593.77 root inner join, equal:[eq(test.t8.b, test.t9.b)]", + " ├─TableReader(Build) 9990.00 root partition:all data:Selection", + " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t9.b))", + " │ └─TableFullScan 10000.00 cop[tikv] table:t9 keep order:false, stats:pseudo", + " └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t8.a, test.t7.a)]", + " ├─TableReader(Build) 9980.01 root partition:all data:Selection", + " │ └─Selection 9980.01 cop[tikv] not(isnull(test.t8.a)), not(isnull(test.t8.b))", + " │ └─TableFullScan 10000.00 cop[tikv] table:t8 keep order:false, stats:pseudo", + " └─TableReader(Probe) 9990.00 root partition:all data:Selection", + " └─Selection 9990.00 cop[tikv] not(isnull(test.t7.a))", + " └─TableFullScan 10000.00 cop[tikv] table:t7 keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain format = 'brief' select /*+ read_from_storage(tikv[t4, t6]), leading(t6), hash_join_build(t4) */ * from t4 join t5 join t6 where t4.a = t5.a and t5.b = t6.b;", + "Plan": [ + "Projection 15593.77 root test.t4.a, test.t4.b, test.t5.a, test.t5.b, test.t6.a, test.t6.b", + "└─HashJoin 15593.77 root inner join, equal:[eq(test.t5.a, test.t4.a)]", + " ├─TableReader(Build) 9990.00 root data:Selection", + " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t4.a))", + " │ └─TableFullScan 10000.00 cop[tikv] table:t4 keep order:false, stats:pseudo", + " └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t6.b, test.t5.b)]", + " ├─TableReader(Build) 9980.01 root MppVersion: 2, data:ExchangeSender", + " │ └─ExchangeSender 9980.01 mpp[tiflash] ExchangeType: PassThrough", + " │ └─Selection 9980.01 mpp[tiflash] not(isnull(test.t5.a)), not(isnull(test.t5.b))", + " │ └─TableFullScan 10000.00 mpp[tiflash] table:t5 pushed down filter:empty, keep order:false, stats:pseudo", + " └─TableReader(Probe) 9990.00 root data:Selection", + " └─Selection 9990.00 cop[tikv] not(isnull(test.t6.b))", + " └─TableFullScan 10000.00 cop[tikv] table:t6 keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain format = 'brief' select /*+ read_from_storage(tikv[t5]), leading(t5), hash_join_probe(t5) */ * from t4 join t5 join t6 where t4.a = t5.a and t5.b = t6.b;", + "Plan": [ + "Projection 15593.77 root test.t4.a, test.t4.b, test.t5.a, test.t5.b, test.t6.a, test.t6.b", + "└─HashJoin 15593.77 root inner join, equal:[eq(test.t5.b, test.t6.b)]", + " ├─TableReader(Build) 9990.00 root MppVersion: 2, data:ExchangeSender", + " │ └─ExchangeSender 9990.00 mpp[tiflash] ExchangeType: PassThrough", + " │ └─Selection 9990.00 mpp[tiflash] not(isnull(test.t6.b))", + " │ └─TableFullScan 10000.00 mpp[tiflash] table:t6 pushed down filter:empty, keep order:false, stats:pseudo", + " └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t5.a, test.t4.a)]", + " ├─TableReader(Build) 9990.00 root MppVersion: 2, data:ExchangeSender", + " │ └─ExchangeSender 9990.00 mpp[tiflash] ExchangeType: PassThrough", + " │ └─Selection 9990.00 mpp[tiflash] not(isnull(test.t4.a))", + " │ └─TableFullScan 10000.00 mpp[tiflash] table:t4 pushed down filter:empty, keep order:false, stats:pseudo", + " └─TableReader(Probe) 9980.01 root data:Selection", + " └─Selection 9980.01 cop[tikv] not(isnull(test.t5.a)), not(isnull(test.t5.b))", + " └─TableFullScan 10000.00 cop[tikv] table:t5 keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain format = 'brief' select /*+ read_from_storage(tiflash[t4, t6]), leading(t6), hash_join_build(t4) */ * from t4 join t5 join t6 where t4.a = t5.a and t5.b = t6.b;", + "Plan": [ + "TableReader 15593.77 root MppVersion: 2, data:ExchangeSender", + "└─ExchangeSender 15593.77 mpp[tiflash] ExchangeType: PassThrough", + " └─Projection 15593.77 mpp[tiflash] test.t4.a, test.t4.b, test.t5.a, test.t5.b, test.t6.a, test.t6.b", + " └─HashJoin 15593.77 mpp[tiflash] inner join, equal:[eq(test.t5.a, test.t4.a)]", + " ├─ExchangeReceiver(Build) 9990.00 mpp[tiflash] ", + " │ └─ExchangeSender 9990.00 mpp[tiflash] ExchangeType: Broadcast, Compression: FAST", + " │ └─Selection 9990.00 mpp[tiflash] not(isnull(test.t4.a))", + " │ └─TableFullScan 10000.00 mpp[tiflash] table:t4 pushed down filter:empty, keep order:false, stats:pseudo", + " └─HashJoin(Probe) 12475.01 mpp[tiflash] inner join, equal:[eq(test.t6.b, test.t5.b)]", + " ├─ExchangeReceiver(Build) 9980.01 mpp[tiflash] ", + " │ └─ExchangeSender 9980.01 mpp[tiflash] ExchangeType: Broadcast, Compression: FAST", + " │ └─Selection 9980.01 mpp[tiflash] not(isnull(test.t5.a)), not(isnull(test.t5.b))", + " │ └─TableFullScan 10000.00 mpp[tiflash] table:t5 pushed down filter:empty, keep order:false, stats:pseudo", + " └─Selection(Probe) 9990.00 mpp[tiflash] not(isnull(test.t6.b))", + " └─TableFullScan 10000.00 mpp[tiflash] table:t6 pushed down filter:empty, keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain format = 'brief' select /*+ read_from_storage(tiflash[t5]), leading(t5), hash_join_probe(t5) */ * from t4 join t5 join t6 where t4.a = t5.a and t5.b = t6.b;", + "Plan": [ + "TableReader 15593.77 root MppVersion: 2, data:ExchangeSender", + "└─ExchangeSender 15593.77 mpp[tiflash] ExchangeType: PassThrough", + " └─Projection 15593.77 mpp[tiflash] test.t4.a, test.t4.b, test.t5.a, test.t5.b, test.t6.a, test.t6.b", + " └─HashJoin 15593.77 mpp[tiflash] inner join, equal:[eq(test.t5.b, test.t6.b)]", + " ├─ExchangeReceiver(Build) 9990.00 mpp[tiflash] ", + " │ └─ExchangeSender 9990.00 mpp[tiflash] ExchangeType: Broadcast, Compression: FAST", + " │ └─Selection 9990.00 mpp[tiflash] not(isnull(test.t6.b))", + " │ └─TableFullScan 10000.00 mpp[tiflash] table:t6 pushed down filter:empty, keep order:false, stats:pseudo", + " └─HashJoin(Probe) 12475.01 mpp[tiflash] inner join, equal:[eq(test.t5.a, test.t4.a)]", + " ├─ExchangeReceiver(Build) 9990.00 mpp[tiflash] ", + " │ └─ExchangeSender 9990.00 mpp[tiflash] ExchangeType: Broadcast, Compression: FAST", + " │ └─Selection 9990.00 mpp[tiflash] not(isnull(test.t4.a))", + " │ └─TableFullScan 10000.00 mpp[tiflash] table:t4 pushed down filter:empty, keep order:false, stats:pseudo", + " └─Selection(Probe) 9980.01 mpp[tiflash] not(isnull(test.t5.a)), not(isnull(test.t5.b))", + " └─TableFullScan 10000.00 mpp[tiflash] table:t5 pushed down filter:empty, keep order:false, stats:pseudo" + ], + "Warn": null + } + ] + }, + { + "Name": "TestReadFromStorageHintAndIsolationRead", + "Cases": [ + { + "SQL": "desc format = 'brief' select /*+ read_from_storage(tikv[t], tiflash[t]) */ 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" + ], + "Warn": [ + "[planner:1815]Storage hints are conflict, you can only specify one storage type of table test.t" + ] + }, + { + "SQL": "desc format = 'brief' select /*+ read_from_storage(tikv[t]) */ 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" + ], + "Warn": null + }, + { + "SQL": "desc format = 'brief' select /*+ read_from_storage(tiflash[t]) */ 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" + ], + "Warn": [ + "[planner:1815]No available path for table test.t with the store type tiflash of the hint /*+ read_from_storage */, please check the status of the table replica and variable value of tidb_isolation_read_engines(map[0:{}])" + ] + } + ] + }, + { + "Name": "TestIsolationReadTiFlashUseIndexHint", + "Cases": [ + { + "SQL": "explain format = 'brief' select * from t", + "Plan": [ + "TableReader 10000.00 root MppVersion: 2, data:ExchangeSender", + "└─ExchangeSender 10000.00 mpp[tiflash] ExchangeType: PassThrough", + " └─TableFullScan 10000.00 mpp[tiflash] table:t keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain format = 'brief' select * from t use index();", + "Plan": [ + "TableReader 10000.00 root MppVersion: 2, data:ExchangeSender", + "└─ExchangeSender 10000.00 mpp[tiflash] ExchangeType: PassThrough", + " └─TableFullScan 10000.00 mpp[tiflash] table:t keep order:false, stats:pseudo" + ], + "Warn": null + }, + { + "SQL": "explain format = 'brief' select /*+ use_index(t, idx)*/ * from t", + "Plan": [ + "TableReader 10000.00 root MppVersion: 2, data:ExchangeSender", + "└─ExchangeSender 10000.00 mpp[tiflash] ExchangeType: PassThrough", + " └─TableFullScan 10000.00 mpp[tiflash] table:t keep order:false, stats:pseudo" + ], + "Warn": [ + "TiDB doesn't support index in the isolation read engines(value: 'tiflash')" + ] + }, + { + "SQL": "explain format = 'brief' select /*+ use_index(t)*/ * from t", + "Plan": [ + "TableReader 10000.00 root MppVersion: 2, data:ExchangeSender", + "└─ExchangeSender 10000.00 mpp[tiflash] ExchangeType: PassThrough", + " └─TableFullScan 10000.00 mpp[tiflash] table:t keep order:false, stats:pseudo" + ], + "Warn": null + } + ] + } +] diff --git a/planner/core/casetest/integration_test.go b/planner/core/casetest/integration_test.go index 5dfc6499ab7c3..6372ca7c2be2d 100644 --- a/planner/core/casetest/integration_test.go +++ b/planner/core/casetest/integration_test.go @@ -22,9 +22,6 @@ import ( "github.com/pingcap/failpoint" "github.com/pingcap/tidb/domain" "github.com/pingcap/tidb/parser/model" - "github.com/pingcap/tidb/parser/terror" - "github.com/pingcap/tidb/planner/core" - "github.com/pingcap/tidb/planner/core/internal" "github.com/pingcap/tidb/session" "github.com/pingcap/tidb/sessionctx/stmtctx" "github.com/pingcap/tidb/sessionctx/variable" @@ -65,25 +62,6 @@ func TestPushLimitDownIndexLookUpReader(t *testing.T) { } } -func TestHintInWrongPos(t *testing.T) { - store := testkit.CreateMockStore(t) - tk := testkit.NewTestKit(t, store) - - tk.MustExec("set tidb_cost_model_version=2") - tk.MustExec("use test") - tk.MustExec("drop table if exists t") - tk.MustExec("create table t(a int, b int)") - - tk.MustExec("select /*+ stream_agg() */ count(*) from t where a > 1;") - tk.MustQuery("show warnings").Check(testkit.Rows()) - - tk.MustExec("select count(*) /*+ stream_agg() */ from t where a > 1;") - tk.MustQuery("show warnings").Check(testkit.Rows("Warning 1064 You have an error in your SQL syntax; check the manual that corresponds to your TiDB version for the right syntax to use [parser:8066]Optimizer hint can only be followed by certain keywords like SELECT, INSERT, etc.")) - - tk.MustExec("select count(*) from (select count(*) as a /*+ stream_agg() */ from t where b > 1 group by b) t1 where a > 1;") - tk.MustQuery("show warnings").Check(testkit.Rows("Warning 1064 You have an error in your SQL syntax; check the manual that corresponds to your TiDB version for the right syntax to use [parser:8066]Optimizer hint can only be followed by certain keywords like SELECT, INSERT, etc.")) -} - func TestAggColumnPrune(t *testing.T) { store := testkit.CreateMockStore(t) tk := testkit.NewTestKit(t, store) @@ -404,347 +382,6 @@ func TestJoinNotSupportedByTiFlash(t *testing.T) { } } -func TestReadFromStorageHint(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("drop table if exists t, tt, ttt") - tk.MustExec("set session tidb_allow_mpp=OFF") - // since allow-mpp is adjusted to false, there will be no physical plan if TiFlash cop is banned. - tk.MustExec("set @@session.tidb_allow_tiflash_cop=ON") - tk.MustExec("create table t(a int, b int, index ia(a))") - tk.MustExec("create table tt(a int, b int, primary key(a))") - tk.MustExec("create table ttt(a int, primary key (a desc))") - - // Create virtual tiflash replica info. - dom := domain.GetDomain(tk.Session()) - is := dom.InfoSchema() - db, exists := is.SchemaByName(model.NewCIStr("test")) - require.True(t, exists) - for _, tblInfo := range db.Tables { - tblInfo.TiFlashReplica = &model.TiFlashReplicaInfo{ - Count: 1, - Available: true, - } - } - - var input []string - var output []struct { - SQL string - Plan []string - Warn []string - } - integrationSuiteData := GetIntegrationSuiteData() - integrationSuiteData.LoadTestCases(t, &input, &output) - for i, tt := range input { - testdata.OnRecord(func() { - output[i].SQL = tt - output[i].Plan = testdata.ConvertRowsToStrings(tk.MustQuery(tt).Rows()) - output[i].Warn = testdata.ConvertSQLWarnToStrings(tk.Session().GetSessionVars().StmtCtx.GetWarnings()) - }) - res := tk.MustQuery(tt) - res.Check(testkit.Rows(output[i].Plan...)) - require.Equal(t, output[i].Warn, testdata.ConvertSQLWarnToStrings(tk.Session().GetSessionVars().StmtCtx.GetWarnings())) - } -} - -func TestKeepOrderHint(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("drop table if exists t, t1, th") - tk.MustExec("drop view if exists v, v1") - tk.MustExec("create table t(a int, b int, primary key(a));") - tk.MustExec("create table t1(a int, b int, index idx_a(a));") - tk.MustExec("create table th (a int, key(a)) partition by hash(a) partitions 4;") - tk.MustExec("create table thp (a int, primary key(a)) partition by hash(a) partitions 4;") - tk.MustExec("create table thh (a int, b int, key(a)) partition by hash(a) partitions 4;") - tk.MustExec("create definer='root'@'localhost' view v as select * from t1 where a<10 order by a limit 1;") - tk.MustExec("create definer='root'@'localhost' view v1 as select * from t where a<10 order by a limit 1;") - - // If the optimizer can not generate the keep order plan, it will report error - err := tk.ExecToErr("explain select /*+ order_index(t1, idx_a) */ * from t1 where a<10 limit 1;") - require.EqualError(t, err, "[planner:1815]Internal : Can't find a proper physical plan for this query") - - err = tk.ExecToErr("explain select /*+ order_index(t, primary) */ * from t where a<10 limit 1;") - require.EqualError(t, err, "[planner:1815]Internal : Can't find a proper physical plan for this query") - - tk.MustExec("analyze table th;") - tk.MustExec("analyze table thp;") - tk.MustExec("analyze table thh;") - err = tk.ExecToErr("select a from th where a<1 order by a limit 1;") - require.NoError(t, err) - - err = tk.ExecToErr("select /*+ order_index(thh, a) */ * from thh where a<1 order by a limit 1;") - require.NoError(t, err) - - var input []string - var output []struct { - SQL string - Plan []string - Warn []string - } - integrationSuiteData := GetIntegrationSuiteData() - integrationSuiteData.LoadTestCases(t, &input, &output) - for i, tt := range input { - testdata.OnRecord(func() { - output[i].SQL = tt - output[i].Plan = testdata.ConvertRowsToStrings(tk.MustQuery(tt).Rows()) - output[i].Warn = testdata.ConvertSQLWarnToStrings(tk.Session().GetSessionVars().StmtCtx.GetWarnings()) - }) - res := tk.MustQuery(tt) - res.Check(testkit.Rows(output[i].Plan...)) - require.Equal(t, output[i].Warn, testdata.ConvertSQLWarnToStrings(tk.Session().GetSessionVars().StmtCtx.GetWarnings())) - } -} - -func TestViewHint(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("drop view if exists v, v1, v2") - tk.MustExec("drop table if exists t, t1, t2") - tk.MustExec("create table t(a int, b int);") - tk.MustExec("create table t1(a int, b int);") - tk.MustExec("create table t2(a int, b int);") - tk.MustExec("create definer='root'@'localhost' view v as select t.a, t.b from t join (select count(*) as a from t1 join t2 on t1.b=t2.b group by t2.a) tt on t.a = tt.a;") - tk.MustExec("create definer='root'@'localhost' view v1 as select t.a, t.b from t join (select count(*) as a from t1 join v on t1.b=v.b group by v.a) tt on t.a = tt.a;") - tk.MustExec("create definer='root'@'localhost' view v2 as select t.a, t.b from t join (select count(*) as a from t1 join v1 on t1.b=v1.b group by v1.a) tt on t.a = tt.a;") - - var input []string - var output []struct { - SQL string - Plan []string - Warn []string - } - integrationSuiteData := GetIntegrationSuiteData() - integrationSuiteData.LoadTestCases(t, &input, &output) - for i, tt := range input { - testdata.OnRecord(func() { - output[i].SQL = tt - output[i].Plan = testdata.ConvertRowsToStrings(tk.MustQuery(tt).Rows()) - output[i].Warn = testdata.ConvertSQLWarnToStrings(tk.Session().GetSessionVars().StmtCtx.GetWarnings()) - }) - res := tk.MustQuery(tt) - res.Check(testkit.Rows(output[i].Plan...)) - require.Equal(t, output[i].Warn, testdata.ConvertSQLWarnToStrings(tk.Session().GetSessionVars().StmtCtx.GetWarnings())) - } -} - -func TestViewHintScope(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("drop view if exists v, v1, v2, v3, v4") - tk.MustExec("drop table if exists t, t1, t2, t3, t4") - tk.MustExec("create table t(a int, b int);") - tk.MustExec("create table t1(a int, b int);") - tk.MustExec("create table t2(a int, b int);") - tk.MustExec("create table t3(a int, b int)") - tk.MustExec("create table t4(a int, b int, index idx_a(a), index idx_b(b))") - tk.MustExec("create definer='root'@'localhost' view v as select t.a, t.b from t join (select count(*) as a from t1 join t2 join t3 where t1.b=t2.b and t2.a = t3.a group by t2.a) tt on t.a = tt.a;") - tk.MustExec("create definer='root'@'localhost' view v1 as select t.a, t.b from t join (select count(*) as a from t1 join v on t1.b=v.b group by v.a) tt on t.a = tt.a;") - tk.MustExec("create definer='root'@'localhost' view v2 as select t.a, t.b from t join (select count(*) as a from t1 join v1 on t1.b=v1.b group by v1.a) tt on t.a = tt.a;") - tk.MustExec("create definer='root'@'localhost' view v3 as select /*+ merge_join(t) */ t.a, t.b from t join (select /*+ stream_agg() */ count(*) as a from t1 join v1 on t1.b=v1.b group by v1.a) tt on t.a = tt.a;") - tk.MustExec("create definer='root'@'localhost' view v4 as select * from t4 where a > 2 and b > 3;") - - var input []string - var output []struct { - SQL string - Plan []string - Warn []string - } - integrationSuiteData := GetIntegrationSuiteData() - integrationSuiteData.LoadTestCases(t, &input, &output) - for i, tt := range input { - testdata.OnRecord(func() { - output[i].SQL = tt - output[i].Plan = testdata.ConvertRowsToStrings(tk.MustQuery(tt).Rows()) - output[i].Warn = testdata.ConvertSQLWarnToStrings(tk.Session().GetSessionVars().StmtCtx.GetWarnings()) - }) - res := tk.MustQuery(tt) - res.Check(testkit.Rows(output[i].Plan...)) - require.Equal(t, output[i].Warn, testdata.ConvertSQLWarnToStrings(tk.Session().GetSessionVars().StmtCtx.GetWarnings())) - } -} - -func TestAllViewHintType(t *testing.T) { - store := testkit.CreateMockStore(t, internal.WithMockTiFlash(2)) - tk := testkit.NewTestKit(t, store) - - tk.MustExec("use test") - tk.MustExec("set tidb_cost_model_version=2") - tk.MustExec("set @@session.tidb_allow_mpp=ON") - tk.MustExec("set @@session.tidb_isolation_read_engines='tiflash, tikv'") - tk.MustExec("drop view if exists v, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12") - tk.MustExec("drop table if exists t, t1, t2, t4, t3, t5") - tk.MustExec("create table t(a int not null, b int, index idx_a(a));") - tk.MustExec("create table t1(a int not null, b int, index idx_a(a));") - tk.MustExec("create table t2(a int, b int, index idx_a(a));") - tk.MustExec("create table t3(a int, b int, index idx_a(a));") - tk.MustExec("create table t4(a int, b int, index idx_a(a));") - tk.MustExec("create table t5(a int, b int, index idx_a(a), index idx_b(b));") - - // Create virtual tiflash replica info. - dom := domain.GetDomain(tk.Session()) - is := dom.InfoSchema() - db, exists := is.SchemaByName(model.NewCIStr("test")) - require.True(t, exists) - for _, tblInfo := range db.Tables { - if tblInfo.Name.L == "t" { - tblInfo.TiFlashReplica = &model.TiFlashReplicaInfo{ - Count: 1, - Available: true, - } - } - } - - tk.MustExec("create definer='root'@'localhost' view v as select t.a, t.b from t join t1 on t.a = t1.a;") - tk.MustExec("create definer='root'@'localhost' view v1 as select t2.a, t2.b from t2 join t3 join v where t2.b = t3.b and t3.a = v.a;") - tk.MustExec("create definer='root'@'localhost' view v2 as select t.a, t.b from t join (select count(*) as a from t1 join v1 on t1.b=v1.b group by v1.a) tt on t.a = tt.a;") - tk.MustExec("create definer='root'@'localhost' view v3 as select * from t5 where a > 1 and b < 2;") - tk.MustExec("create definer='root'@'localhost' view v4 as select * from t5 where a > 1 or b < 2;") - tk.MustExec("create definer='root'@'localhost' view v5 as SELECT * FROM t WHERE EXISTS (SELECT 1 FROM t1 WHERE t1.b = t.b);") - tk.MustExec("create definer='root'@'localhost' view v6 as select * from t1 where t1.a < (select sum(t2.a) from t2 where t2.b = t1.b);") - tk.MustExec("create definer='root'@'localhost' view v7 as WITH CTE AS (SELECT * FROM t WHERE t.a < 60) SELECT * FROM CTE WHERE CTE.a <18 union select * from cte where cte.b > 1;") - tk.MustExec("create definer='root'@'localhost' view v8 as WITH CTE1 AS (SELECT b FROM t1), CTE2 AS (WITH CTE3 AS (SELECT a FROM t2), CTE4 AS (SELECT a FROM t3) SELECT CTE3.a FROM CTE3, CTE4) SELECT b FROM CTE1, CTE2 union select * from CTE1;") - tk.MustExec("create definer='root'@'localhost' view v9 as select sum(a) from t;") - tk.MustExec("create definer='root'@'localhost' view v10 as SELECT * FROM t WHERE a > 10 ORDER BY b LIMIT 1;") - tk.MustExec("create definer='root'@'localhost' view v11 as select a, sum(b) from t group by a") - tk.MustExec("create definer='root'@'localhost' view v12 as select t.a, t.b from t join t t1 on t.a = t1.a;") - - var input []string - var output []struct { - SQL string - Plan []string - Warn []string - } - integrationSuiteData := GetIntegrationSuiteData() - integrationSuiteData.LoadTestCases(t, &input, &output) - for i, tt := range input { - testdata.OnRecord(func() { - output[i].SQL = tt - output[i].Plan = testdata.ConvertRowsToStrings(tk.MustQuery(tt).Rows()) - output[i].Warn = testdata.ConvertSQLWarnToStrings(tk.Session().GetSessionVars().StmtCtx.GetWarnings()) - }) - res := tk.MustQuery(tt) - res.Check(testkit.Rows(output[i].Plan...)) - require.Equal(t, output[i].Warn, testdata.ConvertSQLWarnToStrings(tk.Session().GetSessionVars().StmtCtx.GetWarnings())) - } -} - -func TestJoinHintCompatibility(t *testing.T) { - store := testkit.CreateMockStore(t, internal.WithMockTiFlash(2)) - tk := testkit.NewTestKit(t, store) - - tk.MustExec("use test") - tk.MustExec("set tidb_cost_model_version=2") - tk.MustExec("set @@session.tidb_allow_mpp=ON") - tk.MustExec("set @@session.tidb_isolation_read_engines='tiflash, tikv'") - tk.MustExec("drop view if exists v, v1, v2") - tk.MustExec("drop table if exists t, t1, t2, t3, t4, t5, t6, t7, t8, t9;") - tk.MustExec("create table t(a int not null, b int, index idx_a(a), index idx_b(b));") - tk.MustExec("create table t1(a int not null, b int, index idx_a(a), index idx_b(b));") - tk.MustExec("create table t2(a int, b int, index idx_a(a), index idx_b(b));") - tk.MustExec("create table t3(a int, b int, index idx_a(a), index idx_b(b));") - tk.MustExec("create table t4(a int, b int, index idx_a(a), index idx_b(b));") - tk.MustExec("create table t5(a int, b int, index idx_a(a), index idx_b(b));") - tk.MustExec("create table t6(a int, b int, index idx_a(a), index idx_b(b));") - tk.MustExec("create table t7(a int, b int, index idx_a(a), index idx_b(b)) partition by hash(a) partitions 4;") - tk.MustExec("create table t8(a int, b int, index idx_a(a), index idx_b(b)) partition by hash(a) partitions 4;") - tk.MustExec("create table t9(a int, b int, index idx_a(a), index idx_b(b)) partition by hash(a) partitions 4;") - tk.MustExec("analyze table t7, t8, t9") - - // Create virtual tiflash replica info. - dom := domain.GetDomain(tk.Session()) - is := dom.InfoSchema() - db, exists := is.SchemaByName(model.NewCIStr("test")) - require.True(t, exists) - for _, tblInfo := range db.Tables { - name := tblInfo.Name.L - if name == "t4" || name == "t5" || name == "t6" { - tblInfo.TiFlashReplica = &model.TiFlashReplicaInfo{ - Count: 1, - Available: true, - } - } - } - - tk.MustExec("create definer='root'@'localhost' view v as select /*+ leading(t1), inl_join(t1) */ t.a from t join t1 join t2 where t.a = t1.a and t1.b = t2.b;") - tk.MustExec("create definer='root'@'localhost' view v1 as select /*+ leading(t2), merge_join(t) */ t.a from t join t1 join t2 where t.a = t1.a and t1.b = t2.b;") - tk.MustExec("create definer='root'@'localhost' view v2 as select t.a from t join t1 join t2 where t.a = t1.a and t1.b = t2.b;") - - var input []string - var output []struct { - SQL string - Plan []string - Warn []string - } - integrationSuiteData := GetIntegrationSuiteData() - integrationSuiteData.LoadTestCases(t, &input, &output) - for i, tt := range input { - testdata.OnRecord(func() { - output[i].SQL = tt - output[i].Plan = testdata.ConvertRowsToStrings(tk.MustQuery(tt).Rows()) - output[i].Warn = testdata.ConvertSQLWarnToStrings(tk.Session().GetSessionVars().StmtCtx.GetWarnings()) - }) - res := tk.MustQuery(tt) - res.Check(testkit.Rows(output[i].Plan...)) - require.Equal(t, output[i].Warn, testdata.ConvertSQLWarnToStrings(tk.Session().GetSessionVars().StmtCtx.GetWarnings())) - } -} - -func TestReadFromStorageHintAndIsolationRead(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("drop table if exists t, tt, ttt") - tk.MustExec("create table t(a int, b int, index ia(a))") - tk.MustExec("set @@session.tidb_isolation_read_engines=\"tikv\"") - - // Create virtual tiflash replica info. - dom := domain.GetDomain(tk.Session()) - is := dom.InfoSchema() - db, exists := is.SchemaByName(model.NewCIStr("test")) - require.True(t, exists) - for _, tblInfo := range db.Tables { - tblInfo.TiFlashReplica = &model.TiFlashReplicaInfo{ - Count: 1, - Available: true, - } - } - - var input []string - var output []struct { - SQL string - Plan []string - Warn []string - } - integrationSuiteData := GetIntegrationSuiteData() - integrationSuiteData.LoadTestCases(t, &input, &output) - for i, tt := range input { - tk.Session().GetSessionVars().StmtCtx.SetWarnings(nil) - testdata.OnRecord(func() { - output[i].SQL = tt - output[i].Plan = testdata.ConvertRowsToStrings(tk.MustQuery(tt).Rows()) - output[i].Warn = testdata.ConvertSQLWarnToStrings(tk.Session().GetSessionVars().StmtCtx.GetWarnings()) - }) - res := tk.MustQuery(tt) - res.Check(testkit.Rows(output[i].Plan...)) - require.Equal(t, output[i].Warn, testdata.ConvertSQLWarnToStrings(tk.Session().GetSessionVars().StmtCtx.GetWarnings())) - } -} - func TestIsolationReadTiFlashNotChoosePointGet(t *testing.T) { store := testkit.CreateMockStore(t) tk := testkit.NewTestKit(t, store) @@ -782,47 +419,6 @@ func TestIsolationReadTiFlashNotChoosePointGet(t *testing.T) { } } -func TestIsolationReadTiFlashUseIndexHint(t *testing.T) { - store := testkit.CreateMockStore(t) - tk := testkit.NewTestKit(t, store) - - tk.MustExec("use test") - tk.MustExec("drop table if exists t") - tk.MustExec("create table t(a int, index idx(a));") - - // Create virtual tiflash replica info. - dom := domain.GetDomain(tk.Session()) - is := dom.InfoSchema() - db, exists := is.SchemaByName(model.NewCIStr("test")) - require.True(t, exists) - for _, tblInfo := range db.Tables { - tblInfo.TiFlashReplica = &model.TiFlashReplicaInfo{ - Count: 1, - Available: true, - } - } - - tk.MustExec("set @@session.tidb_isolation_read_engines=\"tiflash\"") - var input []string - var output []struct { - SQL string - Plan []string - Warn []string - } - integrationSuiteData := GetIntegrationSuiteData() - integrationSuiteData.LoadTestCases(t, &input, &output) - for i, tt := range input { - testdata.OnRecord(func() { - output[i].SQL = tt - output[i].Plan = testdata.ConvertRowsToStrings(tk.MustQuery(tt).Rows()) - output[i].Warn = testdata.ConvertSQLWarnToStrings(tk.Session().GetSessionVars().StmtCtx.GetWarnings()) - }) - res := tk.MustQuery(tt) - res.Check(testkit.Rows(output[i].Plan...)) - require.Equal(t, output[i].Warn, testdata.ConvertSQLWarnToStrings(tk.Session().GetSessionVars().StmtCtx.GetWarnings())) - } -} - func TestIsolationReadDoNotFilterSystemDB(t *testing.T) { store := testkit.CreateMockStore(t) tk := testkit.NewTestKit(t, store) @@ -983,30 +579,6 @@ func TestIndexMerge(t *testing.T) { } } -func TestIndexMergeHint4CNF(t *testing.T) { - store := testkit.CreateMockStore(t) - tk := testkit.NewTestKit(t, store) - - tk.MustExec("use test") - tk.MustExec("drop table if exists t") - tk.MustExec("create table t(id int primary key, a int, b int, c int, key(a), key(b), key(c))") - - var input []string - var output []struct { - SQL string - Plan []string - } - integrationSuiteData := GetIntegrationSuiteData() - integrationSuiteData.LoadTestCases(t, &input, &output) - for i, tt := range input { - testdata.OnRecord(func() { - output[i].SQL = tt - output[i].Plan = testdata.ConvertRowsToStrings(tk.MustQuery(tt).Rows()) - }) - tk.MustQuery(tt).Check(testkit.Rows(output[i].Plan...)) - } -} - // for issue #14822 and #38258 func TestIndexJoinTableRange(t *testing.T) { store := testkit.CreateMockStore(t) @@ -1060,48 +632,6 @@ func TestSubqueryWithTopN(t *testing.T) { } } -func TestIndexHintWarning(t *testing.T) { - store := testkit.CreateMockStore(t) - tk := testkit.NewTestKit(t, store) - tk.MustExec("use test") - tk.MustExec("drop table if exists t1, t2") - tk.MustExec("create table t1(a int, b int, c int, key a(a), key b(b))") - tk.MustExec("create table t2(a int, b int, c int, key a(a), key b(b))") - var input []string - var output []struct { - SQL string - Warnings []string - } - integrationSuiteData := GetIntegrationSuiteData() - integrationSuiteData.LoadTestCases(t, &input, &output) - for i, tt := range input { - testdata.OnRecord(func() { - output[i].SQL = tt - tk.MustQuery(tt) - warns := tk.Session().GetSessionVars().StmtCtx.GetWarnings() - output[i].Warnings = make([]string, len(warns)) - for j := range warns { - output[i].Warnings[j] = warns[j].Err.Error() - } - }) - tk.MustQuery(tt) - warns := tk.Session().GetSessionVars().StmtCtx.GetWarnings() - require.Len(t, warns, len(output[i].Warnings)) - for j := range warns { - require.Equal(t, stmtctx.WarnLevelWarning, warns[j].Level) - require.EqualError(t, warns[j].Err, output[i].Warnings[j]) - } - } - //Test view with index hint should result error - tk.MustExec("drop table if exists t1") - tk.MustExec("drop view if exists v1") - tk.MustExec("CREATE TABLE t1 (c1 INT PRIMARY KEY, c2 INT, INDEX (c2))") - tk.MustExec("INSERT INTO t1 VALUES (1,1), (2,2), (3,3)") - tk.MustExec("CREATE VIEW v1 AS SELECT c1, c2 FROM t1") - err := tk.ExecToErr("SELECT * FROM v1 USE INDEX (PRIMARY) WHERE c1=2") - require.True(t, terror.ErrorEqual(err, core.ErrKeyDoesNotExist)) -} - func TestApproxPercentile(t *testing.T) { store := testkit.CreateMockStore(t) tk := testkit.NewTestKit(t, store) @@ -1130,77 +660,6 @@ func TestApproxPercentile(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;") - tk.MustExec("use test") - tk.MustExec("drop table if exists t") - tk.MustExec("create table t(a int primary key, b int, c int, key b(b))") - var input []string - var output []struct { - SQL string - Plan []string - Warnings []string - } - integrationSuiteData := GetIntegrationSuiteData() - integrationSuiteData.LoadTestCases(t, &input, &output) - for i, tt := range input { - testdata.OnRecord(func() { - output[i].SQL = tt - output[i].Plan = testdata.ConvertRowsToStrings(tk.MustQuery(tt).Rows()) - warnings := tk.Session().GetSessionVars().StmtCtx.GetWarnings() - output[i].Warnings = make([]string, len(warnings)) - for j, warning := range warnings { - output[i].Warnings[j] = warning.Err.Error() - } - }) - tk.MustQuery(tt).Check(testkit.Rows(output[i].Plan...)) - warnings := tk.Session().GetSessionVars().StmtCtx.GetWarnings() - require.Len(t, warnings, len(output[i].Warnings)) - for j, warning := range warnings { - require.EqualError(t, warning.Err, output[i].Warnings[j]) - } - } -} - -func TestHintWithoutTableWarning(t *testing.T) { - store := testkit.CreateMockStore(t) - tk := testkit.NewTestKit(t, store) - tk.MustExec("use test") - tk.MustExec("drop table if exists t1, t2") - tk.MustExec("create table t1(a int, b int, c int, key a(a))") - tk.MustExec("create table t2(a int, b int, c int, key a(a))") - var input []string - var output []struct { - SQL string - Warnings []string - } - integrationSuiteData := GetIntegrationSuiteData() - integrationSuiteData.LoadTestCases(t, &input, &output) - for i, tt := range input { - testdata.OnRecord(func() { - output[i].SQL = tt - tk.MustQuery(tt) - warns := tk.Session().GetSessionVars().StmtCtx.GetWarnings() - output[i].Warnings = make([]string, len(warns)) - for j := range warns { - output[i].Warnings[j] = warns[j].Err.Error() - } - }) - tk.MustQuery(tt) - warns := tk.Session().GetSessionVars().StmtCtx.GetWarnings() - require.Len(t, warns, len(output[i].Warnings)) - for j := range warns { - require.Equal(t, stmtctx.WarnLevelWarning, warns[j].Level) - require.EqualError(t, warns[j].Err, output[i].Warnings[j]) - } - } -} - func TestIndexJoinInnerIndexNDV(t *testing.T) { store := testkit.CreateMockStore(t) tk := testkit.NewTestKit(t, store) @@ -1286,60 +745,6 @@ func TestStreamAggProp(t *testing.T) { } } -func TestOptimizeHintOnPartitionTable(t *testing.T) { - store := testkit.CreateMockStore(t) - tk := testkit.NewTestKit(t, store) - - tk.MustExec("use test") - tk.MustExec("drop table if exists t") - tk.MustExec(`create table t ( - a int, b int, c varchar(20), - primary key(a), key(b), key(c) - ) partition by range columns(a) ( - partition p0 values less than(6), - partition p1 values less than(11), - partition p2 values less than(16));`) - tk.MustExec(`insert into t values (1,1,"1"), (2,2,"2"), (8,8,"8"), (11,11,"11"), (15,15,"15")`) - tk.MustExec("set @@tidb_enable_index_merge = off") - defer func() { - tk.MustExec("set @@tidb_enable_index_merge = on") - }() - - // Create virtual tiflash replica info. - dom := domain.GetDomain(tk.Session()) - is := dom.InfoSchema() - db, exists := is.SchemaByName(model.NewCIStr("test")) - require.True(t, exists) - for _, tblInfo := range db.Tables { - if tblInfo.Name.L == "t" { - tblInfo.TiFlashReplica = &model.TiFlashReplicaInfo{ - Count: 1, - Available: true, - } - } - } - - tk.MustExec(`set @@tidb_partition_prune_mode='` + string(variable.Static) + `'`) - - var input []string - var output []struct { - SQL string - Plan []string - Warn []string - } - integrationSuiteData := GetIntegrationSuiteData() - integrationSuiteData.LoadTestCases(t, &input, &output) - for i, tt := range input { - testdata.OnRecord(func() { - output[i].SQL = tt - output[i].Plan = testdata.ConvertRowsToStrings(tk.MustQuery("explain format = 'brief' " + tt).Rows()) - output[i].Warn = testdata.ConvertRowsToStrings(tk.MustQuery("show warnings").Rows()) - }) - tk.MustQuery("explain format = 'brief' " + tt).Check(testkit.Rows(output[i].Plan...)) - tk.MustQuery("show warnings").Check(testkit.Rows(output[i].Warn...)) - } -} - func TestIndexJoinOnClusteredIndex(t *testing.T) { store := testkit.CreateMockStore(t) tk := testkit.NewTestKit(t, store) @@ -1738,33 +1143,6 @@ func TestDecorrelateLimitInSubquery(t *testing.T) { } } -func TestInvalidHint(t *testing.T) { - store := testkit.CreateMockStore(t) - tk := testkit.NewTestKit(t, store) - - tk.MustExec("use test") - tk.MustExec("drop table if exists tt") - tk.MustExec("create table tt(a int, key(a));") - - var input []string - var output []struct { - SQL string - Plan []string - Warnings []string - } - integrationSuiteData := GetIntegrationSuiteData() - integrationSuiteData.LoadTestCases(t, &input, &output) - warning := "show warnings;" - for i, tt := range input { - testdata.OnRecord(func() { - output[i].SQL = tt - output[i].Plan = testdata.ConvertRowsToStrings(tk.MustQuery(tt).Rows()) - output[i].Warnings = testdata.ConvertRowsToStrings(tk.MustQuery(warning).Rows()) - }) - tk.MustQuery(tt).Check(testkit.Rows(output[i].Plan...)) - } -} - func TestConvertRangeToPoint(t *testing.T) { store := testkit.CreateMockStore(t) tk := testkit.NewTestKit(t, store) diff --git a/planner/core/casetest/testdata/integration_suite_in.json b/planner/core/casetest/testdata/integration_suite_in.json index 1b3052f94d8b3..42835d94fced1 100644 --- a/planner/core/casetest/testdata/integration_suite_in.json +++ b/planner/core/casetest/testdata/integration_suite_in.json @@ -88,13 +88,6 @@ "explain format = 'brief' select /*+ USE_INDEX_MERGE(t, a, b, c) */ * from t where 1 or t.a = 1 or t.b = 2" ] }, - { - "name": "TestIndexMergeHint4CNF", - "cases": [ - "explain format = 'brief' select * from t where b = 1 and (a = 1 or c = 1)", - "explain format = 'brief' select /*+ USE_INDEX_MERGE(t, a, c) */ * from t where b = 1 and (a = 1 or c = 1)" - ] - }, { "name": "TestSubqueryWithTopN", "cases": [ @@ -112,49 +105,6 @@ "desc format = 'brief' select /*+ INL_JOIN(t4) */ * from t3 join t4 on t3.b = t4.b where t4.a = 1" ] }, - { - "name": "TestHintWithRequiredProperty", - "cases": [ - "desc format = 'brief' select /*+ INL_JOIN(t2) */ * from t t1, t t2 where t1.a = t2.b order by t2.a", - "desc format = 'brief' select /*+ INL_HASH_JOIN(t2) */ * from t t1, t t2 where t1.a = t2.b order by t2.a", - "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", - "desc format = 'brief' select * from t t1, (select /*+ HASH_AGG() */ b, max(a) from t t2 group by b) t2 where t1.b = t2.b order by t1.b", - "desc format = 'brief' select /*+ INL_HASH_JOIN(t2) */ distinct t2.a from t t1 join t t2 on t1.a = t2.a", - // This hint cannot work, so choose another plan. - "desc format = 'brief' select /*+ INL_JOIN(t2) */ * from t t1, t t2 where t1.a = t2.c order by t1.a" - ] - }, - { - "name": "TestIndexHintWarning", - "cases": [ - "select /*+ USE_INDEX(t1, j) */ * from t1", - "select /*+ IGNORE_INDEX(t1, j) */ * from t1", - "select /*+ USE_INDEX(t2, a, b, c) */ * from t1", - "select /*+ USE_INDEX(t2) */ * from t1", - "select /*+ USE_INDEX(t1, a), USE_INDEX(t2, a), USE_INDEX(t3, a) */ * from t1, t2 where t1.a=t2.a", - "select /*+ USE_INDEX(t3, a), USE_INDEX(t4, b), IGNORE_INDEX(t3, a) */ * from t1, t2 where t1.a=t2.a", - "select /*+ USE_INDEX_MERGE(t3, a, b, d) */ * from t1", - "select /*+ USE_INDEX_MERGE(t1, a, b, c, d) */ * from t1", - "select /*+ USE_INDEX_MERGE(t1, a, b), USE_INDEX(t1, a) */ * from t1", - "select /*+ USE_INDEX_MERGE(t1, a, b), IGNORE_INDEX(t1, a) */ * from t1", - "select /*+ USE_INDEX_MERGE(t1, primary, a, b, c) */ * from t1" - ] - }, - { - "name": "TestHintWithoutTableWarning", - "cases": [ - "select /*+ TIDB_SMJ() */ * from t1, t2 where t1.a=t2.a", - "select /*+ MERGE_JOIN() */ * from t1, t2 where t1.a=t2.a", - "select /*+ INL_JOIN() */ * from t1, t2 where t1.a=t2.a", - "select /*+ TIDB_INLJ() */ * from t1, t2 where t1.a=t2.a", - "select /*+ INL_HASH_JOIN() */ * from t1, t2 where t1.a=t2.a", - "select /*+ INL_MERGE_JOIN() */ * from t1, t2 where t1.a=t2.a", - "select /*+ HASH_JOIN() */ * from t1, t2 where t1.a=t2.a", - "select /*+ USE_INDEX() */ * from t1, t2 where t1.a=t2.a", - "select /*+ IGNORE_INDEX() */ * from t1, t2 where t1.a=t2.a", - "select /*+ USE_INDEX_MERGE() */ * from t1, t2 where t1.a=t2.a" - ] - }, { "name": "TestPartitionPruningForInExpr", "cases": [ @@ -176,20 +126,6 @@ "select /*+ stream_agg() */ count(*) c from t group by a order by a" ] }, - { - "name": "TestOptimizeHintOnPartitionTable", - "cases": [ - "select /*+ use_index(t) */ * from t", - "select /*+ use_index(t partition(p0, p1) b, c) */ * from t partition(p1,p2)", - "select /*+ use_index(t partition(p_non_exist)) */ * from t partition(p1,p2)", - "select /*+ use_index(t partition(p0, p1) b, c) */ * from t", - "select /*+ ignore_index(t partition(p0, p1) b, c) */ * from t", - "select /*+ hash_join(t1, t2 partition(p0)) */ * from t t1 join t t2 on t1.a = t2.a", - "select /*+ use_index_merge(t partition(p0)) */ * from t where t.b = 1 or t.c = \"8\"", - "select /*+ use_index_merge(t partition(p0, p1) primary, b) */ * from t where t.a = 1 or t.b = 2", - "select /*+ use_index(t partition(p0) b) */ * from t partition(p0, p1)" - ] - }, { "name": "TestAccessPathOnClusterIndex", "cases": [ @@ -243,13 +179,6 @@ "select * from pt where id > 4 or c = 7" ] }, - { - "name": "TestInvalidHint", - "cases": [ - "explain format = 'brief' select /*+ use_index_merge(tt) */ * from tt where a=10 or a=20;", - "explain format = 'brief' select /*+ use_index_merge(tt) */ * from tt where a=15 or (a < 10 or a > 20);" - ] - }, { "name": "TestApproxPercentile", "cases": [ @@ -517,300 +446,6 @@ "explain format = 'brief' select * from table_1 a join table_1 b on a.id = b.id and dayofmonth(a.datetime_col) > dayofmonth(b.datetime_col)" ] }, - { - "name": "TestReadFromStorageHint", - "cases": [ - "desc format = 'brief' select avg(a) from t", - "desc format = 'brief' select /*+ read_from_storage(tiflash[t]) */ avg(a) from t", - "desc format = 'brief' select /*+ read_from_storage(tiflash[t]) */ sum(a) from t", - "desc format = 'brief' select /*+ read_from_storage(tiflash[t]) */ sum(a+1) from t", - "desc format = 'brief' select /*+ read_from_storage(tiflash[t]) */ sum(isnull(a)) from t", - "desc format = 'brief' select /*+ READ_FROM_STORAGE(TIKV[t1], TIKV[t2]) */ * from t t1, t t2 where t1.a = t2.a", - "desc format = 'brief' select /*+ READ_FROM_STORAGE(TIKV[t1], TIFLASH[t2]) */ * from t t1, t t2 where t1.a = t2.a", - "desc format = 'brief' select * from tt where (tt.a > 1 and tt.a < 20) or (tt.a >= 30 and tt.a < 55)", - "desc format = 'brief' select /*+ read_from_storage(tiflash[tt]) */ * from tt where (tt.a > 1 and tt.a < 20) or (tt.a >= 30 and tt.a < 55)", - "desc format = 'brief' select * from ttt order by ttt.a desc", - "desc format = 'brief' select /*+ read_from_storage(tiflash[ttt]) */ * from ttt order by ttt.a desc", - "desc format = 'brief' select /*+ read_from_storage(tiflash[ttt]) */ * from ttt order by ttt.a", - "desc format = 'brief' select /*+ read_from_storage(tikv[t, ttt]) */ * from ttt", - "desc format = 'brief' select /*+ read_from_storage(tiflash[t, ttt], tikv[tt]) */ * from ttt" - ] - }, - { - "name": "TestKeepOrderHint", - "cases": [ - "explain select /*+ order_index(t1, idx_a) */ * from t1 where a<10 order by a limit 1;", - "explain select /*+ order_index(t, primary) */ * from t where a<10 order by a limit 1;", - "explain select /*+ no_order_index(t1, idx_a) */ * from t1 where a<10 order by a limit 1;", - "explain select /*+ no_order_index(t, primary) */ * from t where a<10 order by a limit 1;", - "explain select /*+ no_order_index(t1, idx_a) */ * from t1 where a<10 limit 1;", - "explain select /*+ no_order_index(t, primary) */ * from t where a<10 limit 1;", - - // The index doesn't exist - "explain select /*+ order_index(t1, idx_b) */ * from t1 where b<10 order by b limit 1;", - "explain select /*+ order_index(t, idx_b) */ * from t where b<10 order by b limit 1;", - "explain select /*+ no_order_index(t1, idx_b) */ * from t1 where b<10 order by b limit 1;", - "explain select /*+ no_order_index(t, idx_b) */ * from t where b<10 order by b limit 1;", - - // Use the order_index/ no_order_index with the use_index/ ignore_index/ force_index hint at the same time - "explain select /*+ order_index(t1, idx_a) use_index(t1, idx_a) */ * from t1 where a<10 order by a limit 1;", - "explain select /*+ order_index(t1, idx_a) */ * from t1 use index(idx_a) where a<10 order by a limit 1;", - "explain select /*+ order_index(t1, idx_a) force_index(t1, idx_a) */ * from t1 where a<10 order by a limit 1;", - "explain select /*+ order_index(t1, idx_a) */ * from t1 force index(idx_a) where a<10 order by a limit 1;", - "explain select /*+ order_index(t1, idx_a) ignore_index(t1, idx_a) */ * from t1 where a<10 order by a limit 1;", - - "explain select /*+ order_index(t, primary) use_index(t, primary) */ * from t where a<10 order by a limit 1;", - "explain select /*+ order_index(t, primary) */ * from t use index(primary) where a<10 order by a limit 1;", - "explain select /*+ order_index(t, primary) force_index(t, primary) */ * from t where a<10 order by a limit 1;", - "explain select /*+ order_index(t, primary) */ * from t force index(primary) where a<10 order by a limit 1;", - "explain select /*+ order_index(t, primary) ignore_index(t, primary) */ * from t where a<10 order by a limit 1;", - - "explain select /*+ no_order_index(t, primary) use_index(t, primary) */ * from t where a<10 order by a limit 1;", - "explain select /*+ no_order_index(t, primary) */ * from t use index(primary) where a<10 order by a limit 1;", - "explain select /*+ no_order_index(t, primary) force_index(t, primary) */ * from t where a<10 order by a limit 1;", - "explain select /*+ no_order_index(t, primary) */ * from t force index(primary) where a<10 order by a limit 1;", - "explain select /*+ no_order_index(t, primary) ignore_index(t, primary) */ * from t where a<10 order by a limit 1;", - - "explain select /*+ no_order_index(t1, idx_a) use_index(t1, idx_a) */ * from t1 where a<10 order by a limit 1;", - "explain select /*+ no_order_index(t1, idx_a) */ * from t1 use index(idx_a) where a<10 order by a limit 1;", - "explain select /*+ no_order_index(t1, idx_a) force_index(t1, idx_a) */ * from t1 where a<10 order by a limit 1;", - "explain select /*+ no_order_index(t1, idx_a) */ * from t1 force index(idx_a) where a<10 order by a limit 1;", - "explain select /*+ no_order_index(t1, idx_a) ignore_index(t1, idx_a) */ * from t1 where a<10 order by a limit 1;", - - // Use the order_index/ no_order_index with the use_view hint at the same time - "explain select /*+ qb_name(qb, v) order_index(t1@qb, idx_a) */ * from v", - "explain select /*+ qb_name(qb, v1) order_index(t@qb, primary) */ * from v1", - "explain select /*+ qb_name(qb, v) no_order_index(t1@qb, idx_a) */ * from v", - "explain select /*+ qb_name(qb, v1) no_order_index(t@qb, primary) */ * from v1", - - // Use the order_index/ no_order_index with CTE at the same time - "explain WITH CTE AS (select /*+ order_index(t1, idx_a) */ * from t1 where a<10 order by a limit 1) SELECT * FROM CTE WHERE CTE.a <18 union select * from cte where cte.b > 1;", - "explain WITH CTE AS (select /*+ order_index(t, primary) */ * from t where a<10 order by a limit 1) SELECT * FROM CTE WHERE CTE.a <18 union select * from cte where cte.b > 1;", - "explain WITH CTE AS (select /*+ no_order_index(t1, idx_a) */ * from t1 where a<10 order by a limit 1) SELECT * FROM CTE WHERE CTE.a <18 union select * from cte where cte.b > 1;", - "explain WITH CTE AS (select /*+ no_order_index(t, primary) */ * from t where a<10 order by a limit 1) SELECT * FROM CTE WHERE CTE.a <18 union select * from cte where cte.b > 1;", - - // Use hint for partition table - "explain select /*+ order_index(th, a) */ a from th where a<1 order by a limit 1", - "explain select /*+ no_order_index(th, a) */ a from th where a<1 order by a limit 1", - "explain select /*+ order_index(thp, primary) */ a from thp where a<1 order by a limit 1", - "explain select /*+ no_order_index(thp, primary) */ a from thp where a<1 order by a limit 1", - "explain select /*+ order_index(thh, a) */ * from thh where a<1 order by a limit 1" - ] - }, - { - "name": "TestViewHint", - "cases": [ - // Hint for view v - "explain format = 'brief' select /*+ qb_name(qb_v_2, v@sel_1 .@sel_2), merge_join(t1@qb_v_2) */ * from v;", - "explain format = 'brief' select /*+ qb_name(qb_v_2, v@sel_1 .@sel_2), merge_join(t1@qb_v_2), stream_agg(@qb_v_2), qb_name(qb_v_1, v@sel_1 .@sel_1), merge_join(t@qb_v_1) */ * from v;", - "explain format = 'brief' select /*+ qb_name(qb_v_2, v1@sel_1 . v@sel_2 .@sel_2), merge_join(t1@qb_v_2) */ * from v1;", - "explain format = 'brief' select /*+ qb_name(qb_v_2, v1@sel_1 . v@sel_2 .@sel_2), merge_join(t1@qb_v_2), stream_agg(@qb_v_2), qb_name(qb_v_1, v1@sel_1 . v@sel_2 .@sel_1), merge_join(t@qb_v_1) */ * from v1;", - "explain format = 'brief' select /*+ qb_name(qb_v_2, v2@sel_1 . v1@sel_2 . v@sel_2 .@sel_2), merge_join(t1@qb_v_2) */ * from v2;", - "explain format = 'brief' select /*+ qb_name(qb_v_2, v2@sel_1 . v1@sel_2 . v@sel_2 .@sel_2), merge_join(t1@qb_v_2), stream_agg(@qb_v_2), qb_name(qb_v_1, v2@sel_1 . v1@sel_2 . v@sel_2 .@sel_1), merge_join(t@qb_v_1) */ * from v2;", - - // Hint for view v1 - "explain format = 'brief' select /*+ qb_name(qb_v1_2, v1@sel_1 .@sel_2), merge_join(t1@qb_v1_2) */ * from v1;", - "explain format = 'brief' select /*+ qb_name(qb_v1_2, v1@sel_1 .@sel_2), merge_join(t1@qb_v1_2), stream_agg(@qb_v1_2), qb_name(qb_v1_1, v1@sel_1 .@sel_1), merge_join(t@qb_v1_1) */ * from v1;", - "explain format = 'brief' select /*+ qb_name(qb_v1_2, v2@sel_1 . v1@sel_2 .@sel_2), merge_join(t1@qb_v1_2) */ * from v2;", - "explain format = 'brief' select /*+ qb_name(qb_v1_2, v2@sel_1 . v1@sel_2 .@sel_2), merge_join(t1@qb_v1_2), stream_agg(@qb_v1_2), qb_name(qb_v1_1, v2@sel_1 . v1@sel_2 .@sel_1), merge_join(t@qb_v1_1) */ * from v2;", - - // Hint for view v2 - "explain format = 'brief' select /*+ qb_name(qb_v2_2, v2@sel_1 .@sel_2), merge_join(t1@qb_v2_2) */ * from v2;", - "explain format = 'brief' select /*+ qb_name(qb_v2_2, v2@sel_1 .@sel_2), merge_join(t1@qb_v2_2), stream_agg(@qb_v2_2), qb_name(qb_v2_1, v2), merge_join(t@qb_v2_1) */ * from v2;" - ] - }, - { - "name": "TestViewHintScope", - "cases": [ - // Same qb name in one query - "explain format = 'brief' select /*+ qb_name(qb_v, v@sel_1 .@sel_2), qb_name(qb_v, v@sel_1 .@sel_1), merge_join(t1@qb_v) */ * from v;", - "explain format = 'brief' select /*+ qb_name(qb_v, v1@sel_1 .v@sel_2 .@sel_2), qb_name(qb_v, v1@sel_1 .v@sel_2 .@sel_1), merge_join(t1@qb_v) */ * from v1;", - "explain format = 'brief' select /*+ qb_name(qb_v, v2@sel_1 .v1@sel_2 .v@sel_2 .@sel_2), qb_name(qb_v, v2@sel_1 .v1@sel_2 .v@sel_2 .@sel_1), merge_join(t1@qb_v) */ * from v2;", - - // Set the unappeared view name - "explain format = 'brief' select /*+ qb_name(qb_v1_2, v@sel_1 .@sel_2), merge_join(t1@qb_v1_2) */ * from v1;", - "explain format = 'brief' select /*+ qb_name(qb_v1_2, v2@sel_1 . v@sel_1 .@sel_2), merge_join(t1@qb_v1_2) */ * from v2;", - - // Exist the view alias - "explain format = 'brief' select /*+ qb_name(qb_v2_2, vv@sel_1 .@sel_2), merge_join(t1@qb_v2_2) */ * from v2 vv;", - "explain format = 'brief' select /*+ qb_name(qb_v2_2, v2@sel_1 .@sel_2), merge_join(t1@qb_v2_2) */ * from v2 vv;", - - // Tht view hint isn't set in the first query block. - "explain format = 'brief' select * from (select /*+ qb_name(qb_v_2, v@sel_1 .@sel_2), merge_join(t1@qb_v_2) */ * from v) t;", - "explain format = 'brief' select * from (select /*+ qb_name(qb_v_2, v.@sel_2), merge_join(t1@qb_v_2), stream_agg(@qb_v_2), qb_name(qb_v_1, v@sel_1 .@sel1), merge_join(t@qb_v_1) */ * from v) t;", - "explain format = 'brief' select * from (select /*+ qb_name(qb_v_2, v1@sel_1 . v@sel_2 .@sel_2), merge_join(t1@qb_v_2) */ * from v1) t;", - "explain format = 'brief' select * from (select /*+ qb_name(qb_v_2, v1.v@sel_2 .@sel_2), merge_join(t1@qb_v_2), stream_agg(@qb_v_2), qb_name(qb_v_1, v1@sel_1 . v@sel_2 .@sel_1), merge_join(t@qb_v_1) */ * from v1) t;", - - "explain format = 'brief' select /*+ qb_name(qb_v_2, v@sel_2 .@sel_2) */ * from (select /*+ merge_join(t1@qb_v_2) */ * from v) t;", - "explain format = 'brief' select /*+ qb_name(qb_v_2, v@sel_2 .@sel_2), qb_name(qb_v_1, v@sel_2 .@sel1) */ * from (select /*+ merge_join(t1@qb_v_2), stream_agg(@qb_v_2), merge_join(t@qb_v_1) */ * from v) t;", - "explain format = 'brief' select /*+ qb_name(qb_v_2, v1@sel_2 . v@sel_2 .@sel_2) */ * from (select /*+ merge_join(t1@qb_v_2) */ * from v1) t;", - "explain format = 'brief' select /*+ qb_name(qb_v_2, v1@sel_2 . v@sel_2 .@sel_2), qb_name(qb_v_1, v1@sel_2 . v@sel_2 .@sel_1) */ * from (select /*+ merge_join(t1@qb_v_2), stream_agg(@qb_v_2), merge_join(t@qb_v_1) */ * from v1) t;", - - // Define more tables in one view hint - "explain format = 'brief' select /*+ qb_name(qb_v1_2, v2. v1@sel_2 .@sel_2), qb_name(qb_v1_1, v2@sel_1 . v1@sel_2 .@sel_1), merge_join(t1@qb_v1_2, t@qb_v1_1), merge_join(t1@qb_v1_2) */ * from v2;", - "explain format = 'brief' select /*+ qb_name(qb_v_2, v2@sel_1 . v1@sel_2 . v@sel_2 .@sel_2), qb_name(qb_v_1, v2@sel_1 . v1@sel_2 . v@sel_2 .@sel_1), merge_join(t1@qb_v_2, t3@qb_v_2) */ * from v2;", - "explain format = 'brief' select /*+ qb_name(qb_v_2, v2@sel_1 . v1@sel_2 . v@sel_2 .@sel_2), qb_name(qb_v_1, v2@sel_1 . v1@sel_2 . v@sel_2 .@sel_1), merge_join(@qb_v_2 t1, t3) */ * from v2;", - - // Ignore the @sel_1 query block - "explain format = 'brief' select /*+ qb_name(qb_v_2, v .@sel_2), merge_join(t1@qb_v_2) */ * from v;", - "explain format = 'brief' select /*+ qb_name(qb_v_1, v@sel_1), merge_join(t@qb_v_1) */ * from v;", - "explain format = 'brief' select /*+ qb_name(qb_v_2, v1 .v@sel_2 .@sel_2), merge_join(t1@qb_v_2) */ * from v1;", - "explain format = 'brief' select /*+ qb_name(qb_v_1, v1 .v@sel_2), merge_join(t@qb_v_1) */ * from v1;", - - // Use the query block before define it - "explain format = 'brief' select /*+ merge_join(t1@qb_v_2), qb_name(qb_v_2, v@sel_1 .@sel_2) */ * from v;", - "explain format = 'brief' select /*+ merge_join(t@qb_v_1), stream_agg(@qb_v_2), qb_name(qb_v_2, v@sel_1 .@sel_2), qb_name(qb_v_1, v@sel_1 .@sel_1) */ * from v;", - - // The view contains the hint when creation - "explain format = 'brief' select /*+ qb_name(qb_v3_2, v3@sel_1 .@sel_2), merge_join(t1@qb_v3_2) */ * from v3;", - "explain format = 'brief' select /*+ qb_name(qb_v3_2, v3@sel_1 .@sel_2), merge_join(t1@qb_v3_2), hash_agg(@qb_v3_2), qb_name(qb_v3_1, v3@sel_1 .@sel_1), hash_join(t@qb_v3_1) */ * from v3;", - - // The view is in the CTE - "explain with d1 as (\n select a from (\n select a from (\n select /*+ qb_name(qb, v4) use_index(t4@qb, idx_a) */ a from v4 where a < 10\n ) as t0 where a < 9\n ) as t1 where a < 8\n), d2 as (select /*+ qb_name(qb2, v4) use_index(t4@qb2, idx_b) */ a from v4 where b < 10)\n\nselect * from (select * from d1) as t0 join (select * from d2) as t1;", - "explain with d1 as (\n select a from (\n select a from (\n select a from v4 where a < 10\n ) as t0 where a < 9\n ) as t1 where a < 8\n), d2 as (select a from v4 where b < 10)\n\nselect /*+ qb_name(qb, v4@sel_4) use_index(t4@qb, idx_a) qb_name(qb2, v4@sel_5) use_index(t4@qb, idx_b) */ * from (select * from d1) as t0 join (select * from d2) as t1;", - "explain with d1 as (\n select a from (\n select a from (\n select /*+ qb_name(qb, v5) use_index(t4@qb, idx_a) */ a from v4 where a < 10\n ) as t0 where a < 9\n ) as t1 where a < 8\n), d2 as (select /*+ qb_name(qb2, v4) use_index(t4@qb2, idx_b) */ a from v4 where b < 10)\n\nselect * from (select * from d1) as t0 join (select * from d2) as t1;" - ] - }, - { - "name": "TestAllViewHintType", - "cases": [ - // leading hint - // join nodes in the same view - "explain format = 'brief' select /*+ qb_name(qb_v1, v1), leading(@qb_v1 v, t2) */ * from v1;", - "explain format = 'brief' select /*+ qb_name(qb_v1, v1), leading(v@qb_v1, t2@qb_v1) */ * from v1;", - "explain format = 'brief' select /*+ qb_name(qb_v1, v1), leading(@qb_v1 t3, t2) */ * from v1;", - "explain format = 'brief' select /*+ qb_name(qb_v1, v1), leading(t3@qb_v1, t2@qb_v1) */ * from v1;", - - // join node across view - "explain format = 'brief' select /*+ qb_name(qb_v1, v1), qb_name(qb_v, v1.v), leading(t2@qb_v1, t@qb_v) */ * from v1;", - - // hash_join hint - "explain format = 'brief' select /*+ qb_name(qb_v1, v1), hash_join(@qb_v1 v, t2) */ * from v1;", - "explain format = 'brief' select /*+ qb_name(qb_v1, v1), hash_join(t2@qb_v1, t3@qb_v1) */ * from v1;", - - // hash join build hint - "explain format = 'brief' select /*+ qb_name(qb_v1, v1), hash_join_build(@qb_v1 v) */ * from v1;", - "explain format = 'brief' select /*+ qb_name(qb_v1, v1), hash_join_build(t2@qb_v1) */ * from v1;", - - // hash join probe hint - "explain format = 'brief' select /*+ qb_name(qb_v1, v1), hash_join_build(@qb_v1 v) */ * from v1;", - "explain format = 'brief' select /*+ qb_name(qb_v1, v1), hash_join_build(t2@qb_v1) */ * from v1;", - - // merge join hint - "explain format = 'brief' select /*+ qb_name(qb_v1, v1), merge_join(@qb_v1 v) */ * from v1;", - "explain format = 'brief' select /*+ qb_name(qb_v1, v1), merge_join(t2@qb_v1) */ * from v1;", - - // index join hint - "explain format = 'brief' select /*+ qb_name(qb_v, v), INL_JOIN(@qb_v t) */ * from v;", - "explain format = 'brief' select /*+ qb_name(qb_v, v), INL_JOIN(t@qb_v) */ * from v;", - - // agg hint - "explain format = 'brief' select /*+ qb_name(qb_v2, v2.@sel_2), hash_agg(@qb_v2) */ * from v2;", - "explain format = 'brief' select /*+ qb_name(qb_v2, v2.@sel_2), stream_agg(@qb_v2) */ * from v2;", - - // index hint - "explain format = 'brief' select /*+ qb_name(qb_v3, v3), use_index(t5@qb_v3, idx_a) */ * from v3;", - "explain format = 'brief' select /*+ qb_name(qb_v3, v3), use_index(@qb_v3 t5, idx_b) */ * from v3;", - "explain format = 'brief' select /*+ qb_name(qb_v3, v3), force_index(t5@qb_v3, idx_a) */ * from v3;", - "explain format = 'brief' select /*+ qb_name(qb_v3, v3), force_index(@qb_v3 t5, idx_b) */ * from v3;", - "explain format = 'brief' select /*+ qb_name(qb_v3, v3), ignore_index(t5@qb_v3, idx_a) */ * from v3;", - "explain format = 'brief' select /*+ qb_name(qb_v3, v3), ignore_index(@qb_v3 t5, idx_b) */ * from v3;", - "explain format = 'brief' select /*+ qb_name(qb_v4, v4), use_index_merge(t5@qb_v4, idx_a, idx_b) */ * from v4;", - "explain format = 'brief' select /*+ qb_name(qb_v4, v4), use_index_merge(@qb_v4 t5, idx_b, idx_a) */ * from v4;", - - // read from storage - "explain format = 'brief' select /*+ qb_name(qb_v, v), READ_FROM_STORAGE(TIFLASH[t@qb_v], TIKV[t1@qb_v]) */ * from v;", - - // subquery hint - "explain format = 'brief' select /*+ qb_name(qb_v5, v5.@sel_2), SEMI_JOIN_REWRITE(@qb_v5) */ * from v5;", - "explain format = 'brief' select /*+ qb_name(qb_v6, v6.@sel_2), NO_DECORRELATE(@qb_v6) */ * from v6;", - - // cte hint - "explain format = 'brief' select /*+ qb_name(qb_v7, v7), merge(@qb_v7) */ * from v7;", - "explain format = 'brief' select /*+ qb_name(qb_v8, v8), merge(@qb_v8) */ * from v8;", - - // agg to cop hint - "explain format = 'brief' select /*+ qb_name(qb_v9, v9), AGG_TO_COP(@qb_v9) */ * from v9;", - "explain format = 'brief' select /*+ qb_name(qb_v10, v10), LIMIT_TO_COP(@qb_v10) */ * from v10;", - - // MPP hint - "explain format = 'brief' select /*+ qb_name(qb, v11) read_from_storage(tiflash[t@qb]), MPP_1PHASE_AGG(@qb) */ * from v11;", - "explain format = 'brief' select /*+ qb_name(qb, v11) read_from_storage(tiflash[t@qb]), MPP_2PHASE_AGG(@qb) */ * from v11;", - "explain format = 'brief' select /*+ qb_name(qb, v12) read_from_storage(tiflash[t1@qb, t@qb]), shuffle_join(t1@qb, t@qb) */ * from v12;", - "explain format = 'brief' select /*+ qb_name(qb, v12) read_from_storage(tiflash[t1@qb, t@qb]), broadcast_join(t1@qb, t@qb) */ * from v12;" - ] - }, - { - "name": "TestJoinHintCompatibility", - "cases": [ - // different join method hints - "explain format = 'brief' select /*+ leading(t3), hash_join(t1) */ * from t1 join t2 join t3 where t1.a = t2.a and t2.b = t3.b;", - "explain format = 'brief' select /*+ leading(t2), hash_join(t2) */ * from t1 join t2 join t3 where t1.a = t2.a and t2.b = t3.b;", - "explain format = 'brief' select /*+ leading(t3), merge_join(t1) */ * from t1 join t2 join t3 where t1.a = t2.a and t2.b = t3.b;", - "explain format = 'brief' select /*+ leading(t2), merge_join(t2) */ * from t1 join t2 join t3 where t1.a = t2.a and t2.b = t3.b;", - "explain format = 'brief' select /*+ leading(t3), inl_join(t1) */ * from t1 join t2 join t3 where t1.a = t2.a and t2.b = t3.b;", - "explain format = 'brief' select /*+ leading(t2), inl_join(t2) */ * from t1 join t2 join t3 where t1.a = t2.a and t2.b = t3.b;", - "explain format = 'brief' select /*+ leading(t3), hash_join_build(t1) */ * from t1 join t2 join t3 where t1.a = t2.a and t2.b = t3.b;", - "explain format = 'brief' select /*+ leading(t2), hash_join_build(t2) */ * from t1 join t2 join t3 where t1.a = t2.a and t2.b = t3.b;", - "explain format = 'brief' select /*+ leading(t3), hash_join_probe(t1) */ * from t1 join t2 join t3 where t1.a = t2.a and t2.b = t3.b;", - "explain format = 'brief' select /*+ leading(t2), hash_join_probe(t2) */ * from t1 join t2 join t3 where t1.a = t2.a and t2.b = t3.b;", - "explain format = 'brief' select /*+ leading(t6), shuffle_join(t4) */ * from t4 join t5 join t6 where t4.a = t5.a and t5.b = t6.b;", - "explain format = 'brief' select /*+ leading(t5), shuffle_join(t5) */ * from t4 join t5 join t6 where t4.a = t5.a and t5.b = t6.b;", - "explain format = 'brief' select /*+ leading(t6), broadcast_join(t4) */ * from t4 join t5 join t6 where t4.a = t5.a and t5.b = t6.b;", - "explain format = 'brief' select /*+ leading(t5), broadcast_join(t5) */ * from t4 join t5 join t6 where t4.a = t5.a and t5.b = t6.b;", - - // different join type - "explain format = 'brief' select /*+ leading(t3), hash_join(t1) */ * from t1 join t2 on t1.a = t2.a left join t3 on t2.b = t3.b;", - "explain format = 'brief' select /*+ leading(t2), hash_join(t2) */ * from t1 join t2 on t1.a = t2.a left join t3 on t2.b = t3.b;", - "explain format = 'brief' select /*+ leading(t3), merge_join(t1) */ * from t1 right join t2 on t1.a = t2.a join t3 on t2.b = t3.b;", - "explain format = 'brief' select /*+ leading(t2), merge_join(t2) */ * from t1 right join t2 on t1.a = t2.a join t3 on t2.b = t3.b;", - "explain format = 'brief' select /*+ leading(t3), inl_join(t1) */ * from t1 join t2 on t1.a = t2.a straight_join t3 on t2.b = t3.b;", - "explain format = 'brief' select /*+ leading(t2), inl_join(t2) */ * from t1 join t2 on t1.a = t2.a straight_join t3 on t2.b = t3.b;", - "explain format = 'brief' select /*+ leading(t3), hash_join_build(t1) */ * from t1 cross join t2 on t1.a = t2.a join t3 on t2.b = t3.b;", - "explain format = 'brief' select /*+ leading(t2), hash_join_probe(t2) */ * from t1 cross join t2 on t1.a = t2.a join t3 on t2.b = t3.b;", - - // view - "explain format = 'brief' select * from v", - "explain format = 'brief' select * from v1", - "explain format = 'brief' select /*+ qb_name(qb, v2), leading(t2@qb), merge_join(t@qb) */ * from v2", - "explain format = 'brief' select /*+ qb_name(qb, v2), leading(t1@qb), inl_join(t1@qb) */ * from v2", - - // CTE - "explain with tt as (select /*+ leading(t3), merge_join(t1) */ t1.a from t1 join t2 join t3 where t1.a = t2.a and t2.b=t3.b) select * from tt t1 join tt t2 on t1.a=t2.a", - "explain with tt as (select /*+ leading(t2), inl_join(t2) */ t1.a from t1 join t2 join t3 where t1.a = t2.a and t2.b=t3.b) select * from tt t1 join tt t2 on t1.a=t2.a", - "explain with tt as (select /*+ merge(), leading(t3), inl_join(t1) */ t1.a from t1 join t2 join t3 where t1.a = t2.a and t2.b=t3.b) select * from tt t1 join tt t2 on t1.a=t2.a", - "explain with tt as (select /*+ leading(t2), merge_join(t2), merge() */ t1.a from t1 join t2 join t3 where t1.a = t2.a and t2.b=t3.b) select * from tt t1 join tt t2 on t1.a=t2.a", - - // Subquery - "explain format = 'brief' SELECT /*+ leading(t2@sel_2), merge_join(t) */ * FROM t join t1 on t.a = t1.a WHERE EXISTS (SELECT 1 FROM t2 WHERE t2.b = t1.b);", - "explain format = 'brief' SELECT /*+ leading(t1), inl_join(t1) */ * FROM t join t1 on t.a = t1.a WHERE EXISTS (SELECT 1 FROM t2 WHERE t2.b = t1.b);", - "explain format = 'brief' SELECT /*+ leading(t2@sel_2), merge_join(t) */ * FROM t join t1 on t.a = t1.a WHERE EXISTS (SELECT /*+ SEMI_JOIN_REWRITE() */ 1 FROM t2 WHERE t2.b = t1.b);", - "explain format = 'brief' SELECT /*+ leading(t1), inl_join(t1) */ * FROM t join t1 on t.a = t1.a WHERE EXISTS (SELECT /*+ SEMI_JOIN_REWRITE() */ 1 FROM t2 WHERE t2.b = t1.b);", - - "explain format = 'brief' select /*+ leading(t2@sel_2) merge_join(t) */ * from t join t1 on t.a = t1.a where t1.a < (select sum(t2.a) from t2 where t2.b = t1.b);", - "explain format = 'brief' select /*+ leading(t1), inl_join(t1) */ * from t join t1 on t.a = t1.a where t1.a < (select sum(t2.a) from t2 where t2.b = t1.b);", - "explain format = 'brief' select /*+leading(t2@sel_2) merge_join(t) */ * from t join t1 on t.a = t1.a where t1.a < (select /*+ NO_DECORRELATE() */ sum(t2.a) from t2 where t2.b = t1.b);", - "explain format = 'brief' select /*+ leading(t1), inl_join(t1) */ * from t join t1 on t.a = t1.a where t1.a < (select /*+ NO_DECORRELATE() */ sum(t2.a) from t2 where t2.b = t1.b);", - - // Partition table - "explain format = 'brief' select /*+ leading(t9), hash_join(t7) */ * from t7 join t8 join t9 where t7.a = t8.a and t8.b = t9.b;", - "explain format = 'brief' select /*+ leading(t8), hash_join(t8) */ * from t7 join t8 join t9 where t7.a = t8.a and t8.b = t9.b;", - - // other hints - "explain format = 'brief' select /*+ read_from_storage(tikv[t4, t6]), leading(t6), hash_join_build(t4) */ * from t4 join t5 join t6 where t4.a = t5.a and t5.b = t6.b;", - "explain format = 'brief' select /*+ read_from_storage(tikv[t5]), leading(t5), hash_join_probe(t5) */ * from t4 join t5 join t6 where t4.a = t5.a and t5.b = t6.b;", - "explain format = 'brief' select /*+ read_from_storage(tiflash[t4, t6]), leading(t6), hash_join_build(t4) */ * from t4 join t5 join t6 where t4.a = t5.a and t5.b = t6.b;", - "explain format = 'brief' select /*+ read_from_storage(tiflash[t5]), leading(t5), hash_join_probe(t5) */ * from t4 join t5 join t6 where t4.a = t5.a and t5.b = t6.b;" - ] - }, - { - "name": "TestReadFromStorageHintAndIsolationRead", - "cases": [ - "desc format = 'brief' select /*+ read_from_storage(tikv[t], tiflash[t]) */ avg(a) from t", - "desc format = 'brief' select /*+ read_from_storage(tikv[t]) */ avg(a) from t", - "desc format = 'brief' select /*+ read_from_storage(tiflash[t]) */ avg(a) from t" - ] - }, { "name": "TestIsolationReadDoNotFilterSystemDB", "cases": [ @@ -826,15 +461,6 @@ "explain format = 'brief' select * from t where t.a in (1, 2)" ] }, - { - "name": "TestIsolationReadTiFlashUseIndexHint", - "cases": [ - "explain format = 'brief' select * from t", - "explain format = 'brief' select * from t use index();", - "explain format = 'brief' select /*+ use_index(t, idx)*/ * from t", - "explain format = 'brief' select /*+ use_index(t)*/ * from t" - ] - }, { "name": "TestIssue20710", "cases": [ diff --git a/planner/core/casetest/testdata/integration_suite_out.json b/planner/core/casetest/testdata/integration_suite_out.json index 74540dea0eb91..0b48493e9dfef 100644 --- a/planner/core/casetest/testdata/integration_suite_out.json +++ b/planner/core/casetest/testdata/integration_suite_out.json @@ -370,30 +370,6 @@ } ] }, - { - "Name": "TestIndexMergeHint4CNF", - "Cases": [ - { - "SQL": "explain format = 'brief' select * from t where b = 1 and (a = 1 or c = 1)", - "Plan": [ - "IndexLookUp 0.02 root ", - "├─IndexRangeScan(Build) 10.00 cop[tikv] table:t, index:b(b) range:[1,1], keep order:false, stats:pseudo", - "└─Selection(Probe) 0.02 cop[tikv] or(eq(test.t.a, 1), eq(test.t.c, 1))", - " └─TableRowIDScan 10.00 cop[tikv] table:t keep order:false, stats:pseudo" - ] - }, - { - "SQL": "explain format = 'brief' select /*+ USE_INDEX_MERGE(t, a, c) */ * from t where b = 1 and (a = 1 or c = 1)", - "Plan": [ - "IndexMerge 0.02 root type: union", - "├─IndexRangeScan(Build) 10.00 cop[tikv] table:t, index:a(a) range:[1,1], keep order:false, stats:pseudo", - "├─IndexRangeScan(Build) 10.00 cop[tikv] table:t, index:c(c) range:[1,1], keep order:false, stats:pseudo", - "└─Selection(Probe) 0.02 cop[tikv] eq(test.t.b, 1)", - " └─TableRowIDScan 19.99 cop[tikv] table:t keep order:false, stats:pseudo" - ] - } - ] - }, { "Name": "TestSubqueryWithTopN", "Cases": [ @@ -498,237 +474,6 @@ } ] }, - { - "Name": "TestHintWithRequiredProperty", - "Cases": [ - { - "SQL": "desc format = 'brief' select /*+ INL_JOIN(t2) */ * from t t1, t t2 where t1.a = t2.b order by t2.a", - "Plan": [ - "Sort 12487.50 root test.t.a", - "└─Projection 12487.50 root test.t.a, test.t.b, test.t.c, test.t.a, test.t.b, test.t.c", - " └─IndexJoin 12487.50 root inner join, inner:IndexLookUp, outer key:test.t.a, inner key:test.t.b, equal cond:eq(test.t.a, test.t.b)", - " ├─TableReader(Build) 10000.00 root data:TableFullScan", - " │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - " └─IndexLookUp(Probe) 12487.50 root ", - " ├─Selection(Build) 12487.50 cop[tikv] not(isnull(test.t.b))", - " │ └─IndexRangeScan 12500.00 cop[tikv] table:t2, index:b(b) range: decided by [eq(test.t.b, test.t.a)], keep order:false, stats:pseudo", - " └─TableRowIDScan(Probe) 12487.50 cop[tikv] table:t2 keep order:false, stats:pseudo" - ], - "Warnings": [] - }, - { - "SQL": "desc format = 'brief' select /*+ INL_HASH_JOIN(t2) */ * from t t1, t t2 where t1.a = t2.b order by t2.a", - "Plan": [ - "Sort 12487.50 root test.t.a", - "└─Projection 12487.50 root test.t.a, test.t.b, test.t.c, test.t.a, test.t.b, test.t.c", - " └─IndexHashJoin 12487.50 root inner join, inner:IndexLookUp, outer key:test.t.a, inner key:test.t.b, equal cond:eq(test.t.a, test.t.b)", - " ├─TableReader(Build) 10000.00 root data:TableFullScan", - " │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - " └─IndexLookUp(Probe) 12487.50 root ", - " ├─Selection(Build) 12487.50 cop[tikv] not(isnull(test.t.b))", - " │ └─IndexRangeScan 12500.00 cop[tikv] table:t2, index:b(b) range: decided by [eq(test.t.b, test.t.a)], keep order:false, stats:pseudo", - " └─TableRowIDScan(Probe) 12487.50 cop[tikv] table:t2 keep order:false, stats:pseudo" - ], - "Warnings": [] - }, - { - "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)]", - "├─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", - " ├─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" - ], - "Warnings": [] - }, - { - "SQL": "desc format = 'brief' select * from t t1, (select /*+ HASH_AGG() */ b, max(a) from t t2 group by b) t2 where t1.b = t2.b order by t1.b", - "Plan": [ - "Sort 9990.00 root test.t.b", - "└─Projection 9990.00 root test.t.a, test.t.b, test.t.c, test.t.b, Column#7", - " └─HashJoin 9990.00 root inner join, equal:[eq(test.t.b, test.t.b)]", - " ├─HashAgg(Build) 7992.00 root group by:test.t.b, funcs:max(Column#10)->Column#7, funcs:firstrow(test.t.b)->test.t.b", - " │ └─IndexReader 7992.00 root index:HashAgg", - " │ └─HashAgg 7992.00 cop[tikv] group by:test.t.b, funcs:max(test.t.a)->Column#10", - " │ └─IndexFullScan 9990.00 cop[tikv] table:t2, index:b(b) keep order:false, stats:pseudo", - " └─TableReader(Probe) 9990.00 root data:Selection", - " └─Selection 9990.00 cop[tikv] not(isnull(test.t.b))", - " └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo" - ], - "Warnings": [] - }, - { - "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)", - "├─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" - ], - "Warnings": [] - }, - { - "SQL": "desc format = 'brief' select /*+ INL_JOIN(t2) */ * from t t1, t t2 where t1.a = t2.c order by t1.a", - "Plan": [ - "Sort 12487.50 root test.t.a", - "└─Projection 12487.50 root test.t.a, test.t.b, test.t.c, test.t.a, test.t.b, test.t.c", - " └─HashJoin 12487.50 root inner join, equal:[eq(test.t.c, test.t.a)]", - " ├─TableReader(Build) 9990.00 root data:Selection", - " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t.c))", - " │ └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo", - " └─TableReader(Probe) 10000.00 root data:TableFullScan", - " └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo" - ], - "Warnings": [ - "[planner:1815]Optimizer Hint /*+ INL_JOIN(t2) */ or /*+ TIDB_INLJ(t2) */ is inapplicable", - "[planner:1815]Optimizer Hint /*+ INL_JOIN(t2) */ or /*+ TIDB_INLJ(t2) */ is inapplicable" - ] - } - ] - }, - { - "Name": "TestIndexHintWarning", - "Cases": [ - { - "SQL": "select /*+ USE_INDEX(t1, j) */ * from t1", - "Warnings": [ - "[planner:1176]Key 'j' doesn't exist in table 't1'" - ] - }, - { - "SQL": "select /*+ IGNORE_INDEX(t1, j) */ * from t1", - "Warnings": [ - "[planner:1176]Key 'j' doesn't exist in table 't1'" - ] - }, - { - "SQL": "select /*+ USE_INDEX(t2, a, b, c) */ * from t1", - "Warnings": [ - "[planner:1815]use_index(test.t2, a, b, c) is inapplicable, check whether the table(test.t2) exists" - ] - }, - { - "SQL": "select /*+ USE_INDEX(t2) */ * from t1", - "Warnings": [ - "[planner:1815]use_index(test.t2) is inapplicable, check whether the table(test.t2) exists" - ] - }, - { - "SQL": "select /*+ USE_INDEX(t1, a), USE_INDEX(t2, a), USE_INDEX(t3, a) */ * from t1, t2 where t1.a=t2.a", - "Warnings": [ - "[planner:1815]use_index(test.t3, a) is inapplicable, check whether the table(test.t3) exists" - ] - }, - { - "SQL": "select /*+ USE_INDEX(t3, a), USE_INDEX(t4, b), IGNORE_INDEX(t3, a) */ * from t1, t2 where t1.a=t2.a", - "Warnings": [ - "[planner:1815]use_index(test.t3, a) is inapplicable, check whether the table(test.t3) exists", - "[planner:1815]use_index(test.t4, b) is inapplicable, check whether the table(test.t4) exists", - "[planner:1815]ignore_index(test.t3, a) is inapplicable, check whether the table(test.t3) exists" - ] - }, - { - "SQL": "select /*+ USE_INDEX_MERGE(t3, a, b, d) */ * from t1", - "Warnings": [ - "[planner:1815]use_index_merge(test.t3, a, b, d) is inapplicable, check whether the table(test.t3) exists" - ] - }, - { - "SQL": "select /*+ USE_INDEX_MERGE(t1, a, b, c, d) */ * from t1", - "Warnings": [ - "[planner:1815]use_index_merge(test.t1, a, b, c, d) is inapplicable, check whether the indexes (c, d) exist, or the indexes are conflicted with use_index/ignore_index/force_index hints." - ] - }, - { - "SQL": "select /*+ USE_INDEX_MERGE(t1, a, b), USE_INDEX(t1, a) */ * from t1", - "Warnings": [ - "[planner:1815]use_index_merge(test.t1, a, b) is inapplicable, check whether the indexes (b) exist, or the indexes are conflicted with use_index/ignore_index/force_index hints." - ] - }, - { - "SQL": "select /*+ USE_INDEX_MERGE(t1, a, b), IGNORE_INDEX(t1, a) */ * from t1", - "Warnings": [ - "[planner:1815]use_index_merge(test.t1, a, b) is inapplicable, check whether the indexes (a) exist, or the indexes are conflicted with use_index/ignore_index/force_index hints." - ] - }, - { - "SQL": "select /*+ USE_INDEX_MERGE(t1, primary, a, b, c) */ * from t1", - "Warnings": [ - "[planner:1815]use_index_merge(test.t1, primary, a, b, c) is inapplicable, check whether the indexes (c) exist, or the indexes are conflicted with use_index/ignore_index/force_index hints." - ] - } - ] - }, - { - "Name": "TestHintWithoutTableWarning", - "Cases": [ - { - "SQL": "select /*+ TIDB_SMJ() */ * from t1, t2 where t1.a=t2.a", - "Warnings": [ - "[planner:1815]Hint TIDB_SMJ() is inapplicable. Please specify the table names in the arguments." - ] - }, - { - "SQL": "select /*+ MERGE_JOIN() */ * from t1, t2 where t1.a=t2.a", - "Warnings": [ - "[planner:1815]Hint MERGE_JOIN() is inapplicable. Please specify the table names in the arguments." - ] - }, - { - "SQL": "select /*+ INL_JOIN() */ * from t1, t2 where t1.a=t2.a", - "Warnings": [ - "[planner:1815]Hint INL_JOIN() is inapplicable. Please specify the table names in the arguments." - ] - }, - { - "SQL": "select /*+ TIDB_INLJ() */ * from t1, t2 where t1.a=t2.a", - "Warnings": [ - "[planner:1815]Hint TIDB_INLJ() is inapplicable. Please specify the table names in the arguments." - ] - }, - { - "SQL": "select /*+ INL_HASH_JOIN() */ * from t1, t2 where t1.a=t2.a", - "Warnings": [ - "[planner:1815]Hint INL_HASH_JOIN() is inapplicable. Please specify the table names in the arguments." - ] - }, - { - "SQL": "select /*+ INL_MERGE_JOIN() */ * from t1, t2 where t1.a=t2.a", - "Warnings": [ - "[planner:1815]Hint INL_MERGE_JOIN() is inapplicable. Please specify the table names in the arguments." - ] - }, - { - "SQL": "select /*+ HASH_JOIN() */ * from t1, t2 where t1.a=t2.a", - "Warnings": [ - "[planner:1815]Hint HASH_JOIN() is inapplicable. Please specify the table names in the arguments." - ] - }, - { - "SQL": "select /*+ USE_INDEX() */ * from t1, t2 where t1.a=t2.a", - "Warnings": [ - "[parser:1064]Optimizer hint syntax error at line 1 column 22 near \") */\" " - ] - }, - { - "SQL": "select /*+ IGNORE_INDEX() */ * from t1, t2 where t1.a=t2.a", - "Warnings": [ - "[parser:1064]Optimizer hint syntax error at line 1 column 25 near \") */\" " - ] - }, - { - "SQL": "select /*+ USE_INDEX_MERGE() */ * from t1, t2 where t1.a=t2.a", - "Warnings": [ - "[parser:1064]Optimizer hint syntax error at line 1 column 28 near \") */\" " - ] - } - ] - }, { "Name": "TestPartitionPruningForInExpr", "Cases": [ @@ -848,163 +593,6 @@ } ] }, - { - "Name": "TestOptimizeHintOnPartitionTable", - "Cases": [ - { - "SQL": "select /*+ use_index(t) */ * from t", - "Plan": [ - "PartitionUnion 30000.00 root ", - "├─TableReader 10000.00 root data:TableFullScan", - "│ └─TableFullScan 10000.00 cop[tikv] table:t, partition:p0 keep order:false, stats:pseudo", - "├─TableReader 10000.00 root data:TableFullScan", - "│ └─TableFullScan 10000.00 cop[tikv] table:t, partition:p1 keep order:false, stats:pseudo", - "└─TableReader 10000.00 root data:TableFullScan", - " └─TableFullScan 10000.00 cop[tikv] table:t, partition:p2 keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "select /*+ use_index(t partition(p0, p1) b, c) */ * from t partition(p1,p2)", - "Plan": [ - "PartitionUnion 20000.00 root ", - "├─IndexLookUp 10000.00 root ", - "│ ├─IndexFullScan(Build) 10000.00 cop[tikv] table:t, partition:p1, index:b(b) keep order:false, stats:pseudo", - "│ └─TableRowIDScan(Probe) 10000.00 cop[tikv] table:t, partition:p1 keep order:false, stats:pseudo", - "└─TableReader 10000.00 root MppVersion: 2, data:ExchangeSender", - " └─ExchangeSender 10000.00 mpp[tiflash] ExchangeType: PassThrough", - " └─TableFullScan 10000.00 mpp[tiflash] table:t, partition:p2 keep order:false, stats:pseudo" - ], - "Warn": [ - "Warning 1105 unknown partitions (p0) in optimizer hint /*+ USE_INDEX(t PARTITION(p0, p1) b, c) */" - ] - }, - { - "SQL": "select /*+ use_index(t partition(p_non_exist)) */ * from t partition(p1,p2)", - "Plan": [ - "PartitionUnion 20000.00 root ", - "├─TableReader 10000.00 root MppVersion: 2, data:ExchangeSender", - "│ └─ExchangeSender 10000.00 mpp[tiflash] ExchangeType: PassThrough", - "│ └─TableFullScan 10000.00 mpp[tiflash] table:t, partition:p1 keep order:false, stats:pseudo", - "└─TableReader 10000.00 root MppVersion: 2, data:ExchangeSender", - " └─ExchangeSender 10000.00 mpp[tiflash] ExchangeType: PassThrough", - " └─TableFullScan 10000.00 mpp[tiflash] table:t, partition:p2 keep order:false, stats:pseudo" - ], - "Warn": [ - "Warning 1105 unknown partitions (p_non_exist) in optimizer hint /*+ USE_INDEX(t PARTITION(p_non_exist)) */" - ] - }, - { - "SQL": "select /*+ use_index(t partition(p0, p1) b, c) */ * from t", - "Plan": [ - "PartitionUnion 30000.00 root ", - "├─IndexLookUp 10000.00 root ", - "│ ├─IndexFullScan(Build) 10000.00 cop[tikv] table:t, partition:p0, index:b(b) keep order:false, stats:pseudo", - "│ └─TableRowIDScan(Probe) 10000.00 cop[tikv] table:t, partition:p0 keep order:false, stats:pseudo", - "├─IndexLookUp 10000.00 root ", - "│ ├─IndexFullScan(Build) 10000.00 cop[tikv] table:t, partition:p1, index:b(b) keep order:false, stats:pseudo", - "│ └─TableRowIDScan(Probe) 10000.00 cop[tikv] table:t, partition:p1 keep order:false, stats:pseudo", - "└─TableReader 10000.00 root MppVersion: 2, data:ExchangeSender", - " └─ExchangeSender 10000.00 mpp[tiflash] ExchangeType: PassThrough", - " └─TableFullScan 10000.00 mpp[tiflash] table:t, partition:p2 keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "select /*+ ignore_index(t partition(p0, p1) b, c) */ * from t", - "Plan": [ - "PartitionUnion 30000.00 root ", - "├─TableReader 10000.00 root MppVersion: 2, data:ExchangeSender", - "│ └─ExchangeSender 10000.00 mpp[tiflash] ExchangeType: PassThrough", - "│ └─TableFullScan 10000.00 mpp[tiflash] table:t, partition:p0 keep order:false, stats:pseudo", - "├─TableReader 10000.00 root MppVersion: 2, data:ExchangeSender", - "│ └─ExchangeSender 10000.00 mpp[tiflash] ExchangeType: PassThrough", - "│ └─TableFullScan 10000.00 mpp[tiflash] table:t, partition:p1 keep order:false, stats:pseudo", - "└─TableReader 10000.00 root MppVersion: 2, data:ExchangeSender", - " └─ExchangeSender 10000.00 mpp[tiflash] ExchangeType: PassThrough", - " └─TableFullScan 10000.00 mpp[tiflash] table:t, partition:p2 keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "select /*+ hash_join(t1, t2 partition(p0)) */ * from t t1 join t t2 on t1.a = t2.a", - "Plan": [ - "HashJoin 37500.00 root inner join, equal:[eq(test.t.a, test.t.a)]", - "├─PartitionUnion(Build) 30000.00 root ", - "│ ├─TableReader 10000.00 root MppVersion: 2, data:ExchangeSender", - "│ │ └─ExchangeSender 10000.00 mpp[tiflash] ExchangeType: PassThrough", - "│ │ └─TableFullScan 10000.00 mpp[tiflash] table:t2, partition:p0 keep order:false, stats:pseudo", - "│ ├─TableReader 10000.00 root MppVersion: 2, data:ExchangeSender", - "│ │ └─ExchangeSender 10000.00 mpp[tiflash] ExchangeType: PassThrough", - "│ │ └─TableFullScan 10000.00 mpp[tiflash] table:t2, partition:p1 keep order:false, stats:pseudo", - "│ └─TableReader 10000.00 root MppVersion: 2, data:ExchangeSender", - "│ └─ExchangeSender 10000.00 mpp[tiflash] ExchangeType: PassThrough", - "│ └─TableFullScan 10000.00 mpp[tiflash] table:t2, partition:p2 keep order:false, stats:pseudo", - "└─PartitionUnion(Probe) 30000.00 root ", - " ├─TableReader 10000.00 root MppVersion: 2, data:ExchangeSender", - " │ └─ExchangeSender 10000.00 mpp[tiflash] ExchangeType: PassThrough", - " │ └─TableFullScan 10000.00 mpp[tiflash] table:t1, partition:p0 keep order:false, stats:pseudo", - " ├─TableReader 10000.00 root MppVersion: 2, data:ExchangeSender", - " │ └─ExchangeSender 10000.00 mpp[tiflash] ExchangeType: PassThrough", - " │ └─TableFullScan 10000.00 mpp[tiflash] table:t1, partition:p1 keep order:false, stats:pseudo", - " └─TableReader 10000.00 root MppVersion: 2, data:ExchangeSender", - " └─ExchangeSender 10000.00 mpp[tiflash] ExchangeType: PassThrough", - " └─TableFullScan 10000.00 mpp[tiflash] table:t1, partition:p2 keep order:false, stats:pseudo" - ], - "Warn": [ - "Warning 1105 Optimizer Hint /*+ HASH_JOIN(t1, t2 PARTITION(p0)) */ is inapplicable on specified partitions" - ] - }, - { - "SQL": "select /*+ use_index_merge(t partition(p0)) */ * from t where t.b = 1 or t.c = \"8\"", - "Plan": [ - "PartitionUnion 59.97 root ", - "├─IndexMerge 19.99 root type: union", - "│ ├─IndexRangeScan(Build) 10.00 cop[tikv] table:t, partition:p0, index:b(b) range:[1,1], keep order:false, stats:pseudo", - "│ ├─IndexRangeScan(Build) 10.00 cop[tikv] table:t, partition:p0, index:c(c) range:[\"8\",\"8\"], keep order:false, stats:pseudo", - "│ └─TableRowIDScan(Probe) 19.99 cop[tikv] table:t, partition:p0 keep order:false, stats:pseudo", - "├─TableReader 19.99 root MppVersion: 2, data:ExchangeSender", - "│ └─ExchangeSender 19.99 mpp[tiflash] ExchangeType: PassThrough", - "│ └─TableFullScan 19.99 mpp[tiflash] table:t, partition:p1 pushed down filter:or(eq(test.t.b, 1), eq(test.t.c, \"8\")), keep order:false, stats:pseudo", - "└─TableReader 19.99 root MppVersion: 2, data:ExchangeSender", - " └─ExchangeSender 19.99 mpp[tiflash] ExchangeType: PassThrough", - " └─TableFullScan 19.99 mpp[tiflash] table:t, partition:p2 pushed down filter:or(eq(test.t.b, 1), eq(test.t.c, \"8\")), keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "select /*+ use_index_merge(t partition(p0, p1) primary, b) */ * from t where t.a = 1 or t.b = 2", - "Plan": [ - "PartitionUnion 33.00 root ", - "├─IndexMerge 11.00 root type: union", - "│ ├─TableRangeScan(Build) 1.00 cop[tikv] table:t, partition:p0 range:[1,1], keep order:false, stats:pseudo", - "│ ├─IndexRangeScan(Build) 10.00 cop[tikv] table:t, partition:p0, index:b(b) range:[2,2], keep order:false, stats:pseudo", - "│ └─TableRowIDScan(Probe) 11.00 cop[tikv] table:t, partition:p0 keep order:false, stats:pseudo", - "├─IndexMerge 11.00 root type: union", - "│ ├─TableRangeScan(Build) 1.00 cop[tikv] table:t, partition:p1 range:[1,1], keep order:false, stats:pseudo", - "│ ├─IndexRangeScan(Build) 10.00 cop[tikv] table:t, partition:p1, index:b(b) range:[2,2], keep order:false, stats:pseudo", - "│ └─TableRowIDScan(Probe) 11.00 cop[tikv] table:t, partition:p1 keep order:false, stats:pseudo", - "└─TableReader 11.00 root MppVersion: 2, data:ExchangeSender", - " └─ExchangeSender 11.00 mpp[tiflash] ExchangeType: PassThrough", - " └─TableFullScan 11.00 mpp[tiflash] table:t, partition:p2 pushed down filter:or(eq(test.t.a, 1), eq(test.t.b, 2)), keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "select /*+ use_index(t partition(p0) b) */ * from t partition(p0, p1)", - "Plan": [ - "PartitionUnion 20000.00 root ", - "├─IndexLookUp 10000.00 root ", - "│ ├─IndexFullScan(Build) 10000.00 cop[tikv] table:t, partition:p0, index:b(b) keep order:false, stats:pseudo", - "│ └─TableRowIDScan(Probe) 10000.00 cop[tikv] table:t, partition:p0 keep order:false, stats:pseudo", - "└─TableReader 10000.00 root MppVersion: 2, data:ExchangeSender", - " └─ExchangeSender 10000.00 mpp[tiflash] ExchangeType: PassThrough", - " └─TableFullScan 10000.00 mpp[tiflash] table:t, partition:p1 keep order:false, stats:pseudo" - ], - "Warn": null - } - ] - }, { "Name": "TestAccessPathOnClusterIndex", "Cases": [ @@ -1373,31 +961,6 @@ } ] }, - { - "Name": "TestInvalidHint", - "Cases": [ - { - "SQL": "explain format = 'brief' select /*+ use_index_merge(tt) */ * from tt where a=10 or a=20;", - "Plan": [ - "IndexReader 20.00 root index:IndexRangeScan", - "└─IndexRangeScan 20.00 cop[tikv] table:tt, index:a(a) range:[10,10], [20,20], keep order:false, stats:pseudo" - ], - "Warnings": [ - "Warning 1105 IndexMerge is inapplicable" - ] - }, - { - "SQL": "explain format = 'brief' select /*+ use_index_merge(tt) */ * from tt where a=15 or (a < 10 or a > 20);", - "Plan": [ - "IndexReader 6666.67 root index:IndexRangeScan", - "└─IndexRangeScan 6666.67 cop[tikv] table:tt, index:a(a) range:[-inf,10), [15,15], (20,+inf], keep order:false, stats:pseudo" - ], - "Warnings": [ - "Warning 1105 IndexMerge is inapplicable" - ] - } - ] - }, { "Name": "TestApproxPercentile", "Cases": [ @@ -3019,3548 +2582,39 @@ ] }, { - "Name": "TestReadFromStorageHint", + "Name": "TestIsolationReadDoNotFilterSystemDB", "Cases": [ { - "SQL": "desc format = 'brief' select avg(a) from t", + "SQL": "desc format = 'brief' select * from metrics_schema.tidb_query_duration where time >= '2019-12-23 16:10:13' and time <= '2019-12-23 16:30:13'", "Plan": [ - "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->Column#9, cast(test.t.a, decimal(10,0) BINARY)->Column#10", - " └─TableFullScan 10000.00 batchCop[tiflash] table:t keep order:false, stats:pseudo" - ], - "Warn": null + "MemTableScan 10000.00 root table:tidb_query_duration PromQL:histogram_quantile(0.9, sum(rate(tidb_server_handle_query_duration_seconds_bucket{}[60s])) by (le,sql_type,instance)), start_time:2019-12-23 16:10:13, end_time:2019-12-23 16:30:13, step:1m0s" + ] }, { - "SQL": "desc format = 'brief' select /*+ read_from_storage(tiflash[t]) */ avg(a) from t", + "SQL": "desc format = 'brief' select * from information_schema.tables", "Plan": [ - "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->Column#9, cast(test.t.a, decimal(10,0) BINARY)->Column#10", - " └─TableFullScan 10000.00 batchCop[tiflash] table:t keep order:false, stats:pseudo" - ], - "Warn": null + "MemTableScan 10000.00 root table:TABLES " + ] }, { - "SQL": "desc format = 'brief' select /*+ read_from_storage(tiflash[t]) */ sum(a) from t", + "SQL": "desc format = 'brief' select * from mysql.stats_meta", "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", - " └─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" - ], - "Warn": null - }, - { - "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", - " └─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" - ], - "Warn": null - }, - { - "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", - " └─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" - ], - "Warn": null - }, - { - "SQL": "desc format = 'brief' select /*+ READ_FROM_STORAGE(TIKV[t1], TIKV[t2]) */ * from t t1, t t2 where t1.a = t2.a", - "Plan": [ - "HashJoin 12487.50 root inner join, equal:[eq(test.t.a, test.t.a)]", - "├─TableReader(Build) 9990.00 root data:Selection", - "│ └─Selection 9990.00 cop[tikv] not(isnull(test.t.a))", - "│ └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo", - "└─TableReader(Probe) 9990.00 root data:Selection", - " └─Selection 9990.00 cop[tikv] not(isnull(test.t.a))", - " └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "desc format = 'brief' select /*+ READ_FROM_STORAGE(TIKV[t1], TIFLASH[t2]) */ * from t t1, t t2 where t1.a = t2.a", - "Plan": [ - "HashJoin 12487.50 root inner join, equal:[eq(test.t.a, test.t.a)]", - "├─TableReader(Build) 9990.00 root data:Selection", - "│ └─Selection 9990.00 cop[tiflash] not(isnull(test.t.a))", - "│ └─TableFullScan 10000.00 cop[tiflash] table:t2 pushed down filter:empty, keep order:false, stats:pseudo", - "└─TableReader(Probe) 9990.00 root data:Selection", - " └─Selection 9990.00 cop[tikv] not(isnull(test.t.a))", - " └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "desc format = 'brief' select * from tt where (tt.a > 1 and tt.a < 20) or (tt.a >= 30 and tt.a < 55)", - "Plan": [ - "TableReader 44.00 root data:TableRangeScan", - "└─TableRangeScan 44.00 cop[tikv] table:tt range:(1,20), [30,55), keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "desc format = 'brief' select /*+ read_from_storage(tiflash[tt]) */ * from tt where (tt.a > 1 and tt.a < 20) or (tt.a >= 30 and tt.a < 55)", - "Plan": [ - "TableReader 44.00 root data:TableRangeScan", - "└─TableRangeScan 44.00 cop[tiflash] table:tt range:(1,20), [30,55), keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "desc format = 'brief' select * from ttt order by ttt.a desc", - "Plan": [ - "TableReader 10000.00 root data:TableFullScan", - "└─TableFullScan 10000.00 cop[tikv] table:ttt keep order:true, desc, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "desc format = 'brief' select /*+ read_from_storage(tiflash[ttt]) */ * from ttt order by ttt.a desc", - "Plan": [ - "Sort 10000.00 root test.ttt.a:desc", - "└─TableReader 10000.00 root data:TableFullScan", - " └─TableFullScan 10000.00 cop[tiflash] table:ttt keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "desc format = 'brief' select /*+ read_from_storage(tiflash[ttt]) */ * from ttt order by ttt.a", - "Plan": [ - "TableReader 10000.00 root data:TableFullScan", - "└─TableFullScan 10000.00 cop[tiflash] table:ttt keep order:true, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "desc format = 'brief' select /*+ read_from_storage(tikv[t, ttt]) */ * from ttt", - "Plan": [ - "TableReader 10000.00 root data:TableFullScan", - "└─TableFullScan 10000.00 cop[tikv] table:ttt keep order:false, stats:pseudo" - ], - "Warn": [ - "[planner:1815]There are no matching table names for (t) in optimizer hint /*+ READ_FROM_STORAGE(tikv[t, ttt]) */. Maybe you can use the table alias name" - ] - }, - { - "SQL": "desc format = 'brief' select /*+ read_from_storage(tiflash[t, ttt], tikv[tt]) */ * from ttt", - "Plan": [ - "TableReader 10000.00 root data:TableFullScan", - "└─TableFullScan 10000.00 cop[tiflash] table:ttt keep order:false, stats:pseudo" - ], - "Warn": [ - "[planner:1815]There are no matching table names for (t, tt) in optimizer hint /*+ READ_FROM_STORAGE(tiflash[t, ttt], tikv[tt]) */. Maybe you can use the table alias name" - ] - } - ] - }, - { - "Name": "TestKeepOrderHint", - "Cases": [ - { - "SQL": "explain select /*+ order_index(t1, idx_a) */ * from t1 where a<10 order by a limit 1;", - "Plan": [ - "Projection_17 1.00 root test.t1.a, test.t1.b", - "└─IndexLookUp_16 1.00 root limit embedded(offset:0, count:1)", - " ├─Limit_15(Build) 1.00 cop[tikv] offset:0, count:1", - " │ └─IndexRangeScan_13 1.00 cop[tikv] table:t1, index:idx_a(a) range:[-inf,10), keep order:true, stats:pseudo", - " └─TableRowIDScan_14(Probe) 1.00 cop[tikv] table:t1 keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain select /*+ order_index(t, primary) */ * from t where a<10 order by a limit 1;", - "Plan": [ - "Limit_11 1.00 root offset:0, count:1", - "└─TableReader_15 1.00 root data:Limit_14", - " └─Limit_14 1.00 cop[tikv] offset:0, count:1", - " └─TableRangeScan_13 333.33 cop[tikv] table:t range:[-inf,10), keep order:true, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain select /*+ no_order_index(t1, idx_a) */ * from t1 where a<10 order by a limit 1;", - "Plan": [ - "TopN_9 1.00 root test.t1.a, offset:0, count:1", - "└─IndexLookUp_16 1.00 root ", - " ├─TopN_15(Build) 1.00 cop[tikv] test.t1.a, offset:0, count:1", - " │ └─IndexRangeScan_13 3323.33 cop[tikv] table:t1, index:idx_a(a) range:[-inf,10), keep order:false, stats:pseudo", - " └─TableRowIDScan_14(Probe) 1.00 cop[tikv] table:t1 keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain select /*+ no_order_index(t, primary) */ * from t where a<10 order by a limit 1;", - "Plan": [ - "TopN_8 1.00 root test.t.a, offset:0, count:1", - "└─TableReader_15 1.00 root data:TopN_14", - " └─TopN_14 1.00 cop[tikv] test.t.a, offset:0, count:1", - " └─TableRangeScan_13 3333.33 cop[tikv] table:t range:[-inf,10), keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain select /*+ no_order_index(t1, idx_a) */ * from t1 where a<10 limit 1;", - "Plan": [ - "IndexLookUp_13 1.00 root limit embedded(offset:0, count:1)", - "├─Limit_12(Build) 1.00 cop[tikv] offset:0, count:1", - "│ └─IndexRangeScan_10 1.00 cop[tikv] table:t1, index:idx_a(a) range:[-inf,10), keep order:false, stats:pseudo", - "└─TableRowIDScan_11(Probe) 1.00 cop[tikv] table:t1 keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain select /*+ no_order_index(t, primary) */ * from t where a<10 limit 1;", - "Plan": [ - "Limit_8 1.00 root offset:0, count:1", - "└─TableReader_12 1.00 root data:Limit_11", - " └─Limit_11 1.00 cop[tikv] offset:0, count:1", - " └─TableRangeScan_10 333.33 cop[tikv] table:t range:[-inf,10), keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain select /*+ order_index(t1, idx_b) */ * from t1 where b<10 order by b limit 1;", - "Plan": [ - "TopN_8 1.00 root test.t1.b, offset:0, count:1", - "└─TableReader_16 1.00 root data:TopN_15", - " └─TopN_15 1.00 cop[tikv] test.t1.b, offset:0, count:1", - " └─Selection_14 3323.33 cop[tikv] lt(test.t1.b, 10)", - " └─TableFullScan_13 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo" - ], - "Warn": [ - "[planner:1176]Key 'idx_b' doesn't exist in table 't1'" - ] - }, - { - "SQL": "explain select /*+ order_index(t, idx_b) */ * from t where b<10 order by b limit 1;", - "Plan": [ - "TopN_8 1.00 root test.t.b, offset:0, count:1", - "└─TableReader_16 1.00 root data:TopN_15", - " └─TopN_15 1.00 cop[tikv] test.t.b, offset:0, count:1", - " └─Selection_14 3323.33 cop[tikv] lt(test.t.b, 10)", - " └─TableFullScan_13 10000.00 cop[tikv] table:t keep order:false, stats:pseudo" - ], - "Warn": [ - "[planner:1176]Key 'idx_b' doesn't exist in table 't'" - ] - }, - { - "SQL": "explain select /*+ no_order_index(t1, idx_b) */ * from t1 where b<10 order by b limit 1;", - "Plan": [ - "TopN_8 1.00 root test.t1.b, offset:0, count:1", - "└─TableReader_16 1.00 root data:TopN_15", - " └─TopN_15 1.00 cop[tikv] test.t1.b, offset:0, count:1", - " └─Selection_14 3323.33 cop[tikv] lt(test.t1.b, 10)", - " └─TableFullScan_13 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo" - ], - "Warn": [ - "[planner:1176]Key 'idx_b' doesn't exist in table 't1'" - ] - }, - { - "SQL": "explain select /*+ no_order_index(t, idx_b) */ * from t where b<10 order by b limit 1;", - "Plan": [ - "TopN_8 1.00 root test.t.b, offset:0, count:1", - "└─TableReader_16 1.00 root data:TopN_15", - " └─TopN_15 1.00 cop[tikv] test.t.b, offset:0, count:1", - " └─Selection_14 3323.33 cop[tikv] lt(test.t.b, 10)", - " └─TableFullScan_13 10000.00 cop[tikv] table:t keep order:false, stats:pseudo" - ], - "Warn": [ - "[planner:1176]Key 'idx_b' doesn't exist in table 't'" - ] - }, - { - "SQL": "explain select /*+ order_index(t1, idx_a) use_index(t1, idx_a) */ * from t1 where a<10 order by a limit 1;", - "Plan": [ - "Projection_19 1.00 root test.t1.a, test.t1.b", - "└─IndexLookUp_18 1.00 root limit embedded(offset:0, count:1)", - " ├─Limit_17(Build) 1.00 cop[tikv] offset:0, count:1", - " │ └─IndexRangeScan_13 1.00 cop[tikv] table:t1, index:idx_a(a) range:[-inf,10), keep order:true, stats:pseudo", - " └─TableRowIDScan_14(Probe) 1.00 cop[tikv] table:t1 keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain select /*+ order_index(t1, idx_a) */ * from t1 use index(idx_a) where a<10 order by a limit 1;", - "Plan": [ - "Projection_19 1.00 root test.t1.a, test.t1.b", - "└─IndexLookUp_18 1.00 root limit embedded(offset:0, count:1)", - " ├─Limit_17(Build) 1.00 cop[tikv] offset:0, count:1", - " │ └─IndexRangeScan_13 1.00 cop[tikv] table:t1, index:idx_a(a) range:[-inf,10), keep order:true, stats:pseudo", - " └─TableRowIDScan_14(Probe) 1.00 cop[tikv] table:t1 keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain select /*+ order_index(t1, idx_a) force_index(t1, idx_a) */ * from t1 where a<10 order by a limit 1;", - "Plan": [ - "Projection_19 1.00 root test.t1.a, test.t1.b", - "└─IndexLookUp_18 1.00 root limit embedded(offset:0, count:1)", - " ├─Limit_17(Build) 1.00 cop[tikv] offset:0, count:1", - " │ └─IndexRangeScan_13 1.00 cop[tikv] table:t1, index:idx_a(a) range:[-inf,10), keep order:true, stats:pseudo", - " └─TableRowIDScan_14(Probe) 1.00 cop[tikv] table:t1 keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain select /*+ order_index(t1, idx_a) */ * from t1 force index(idx_a) where a<10 order by a limit 1;", - "Plan": [ - "Projection_19 1.00 root test.t1.a, test.t1.b", - "└─IndexLookUp_18 1.00 root limit embedded(offset:0, count:1)", - " ├─Limit_17(Build) 1.00 cop[tikv] offset:0, count:1", - " │ └─IndexRangeScan_13 1.00 cop[tikv] table:t1, index:idx_a(a) range:[-inf,10), keep order:true, stats:pseudo", - " └─TableRowIDScan_14(Probe) 1.00 cop[tikv] table:t1 keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain select /*+ order_index(t1, idx_a) ignore_index(t1, idx_a) */ * from t1 where a<10 order by a limit 1;", - "Plan": [ - "TopN_8 1.00 root test.t1.a, offset:0, count:1", - "└─TableReader_16 1.00 root data:TopN_15", - " └─TopN_15 1.00 cop[tikv] test.t1.a, offset:0, count:1", - " └─Selection_14 3323.33 cop[tikv] lt(test.t1.a, 10)", - " └─TableFullScan_13 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain select /*+ order_index(t, primary) use_index(t, primary) */ * from t where a<10 order by a limit 1;", - "Plan": [ - "Limit_11 1.00 root offset:0, count:1", - "└─TableReader_16 1.00 root data:Limit_15", - " └─Limit_15 1.00 cop[tikv] offset:0, count:1", - " └─TableRangeScan_13 333.33 cop[tikv] table:t range:[-inf,10), keep order:true, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain select /*+ order_index(t, primary) */ * from t use index(primary) where a<10 order by a limit 1;", - "Plan": [ - "Limit_11 1.00 root offset:0, count:1", - "└─TableReader_16 1.00 root data:Limit_15", - " └─Limit_15 1.00 cop[tikv] offset:0, count:1", - " └─TableRangeScan_13 333.33 cop[tikv] table:t range:[-inf,10), keep order:true, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain select /*+ order_index(t, primary) force_index(t, primary) */ * from t where a<10 order by a limit 1;", - "Plan": [ - "Limit_11 1.00 root offset:0, count:1", - "└─TableReader_16 1.00 root data:Limit_15", - " └─Limit_15 1.00 cop[tikv] offset:0, count:1", - " └─TableRangeScan_13 333.33 cop[tikv] table:t range:[-inf,10), keep order:true, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain select /*+ order_index(t, primary) */ * from t force index(primary) where a<10 order by a limit 1;", - "Plan": [ - "Limit_11 1.00 root offset:0, count:1", - "└─TableReader_16 1.00 root data:Limit_15", - " └─Limit_15 1.00 cop[tikv] offset:0, count:1", - " └─TableRangeScan_13 333.33 cop[tikv] table:t range:[-inf,10), keep order:true, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain select /*+ order_index(t, primary) ignore_index(t, primary) */ * from t where a<10 order by a limit 1;", - "Plan": [ - "Limit_11 1.00 root offset:0, count:1", - "└─TableReader_15 1.00 root data:Limit_14", - " └─Limit_14 1.00 cop[tikv] offset:0, count:1", - " └─TableRangeScan_13 333.33 cop[tikv] table:t range:[-inf,10), keep order:true, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain select /*+ no_order_index(t, primary) use_index(t, primary) */ * from t where a<10 order by a limit 1;", - "Plan": [ - "TopN_8 1.00 root test.t.a, offset:0, count:1", - "└─TableReader_16 1.00 root data:TopN_15", - " └─TopN_15 1.00 cop[tikv] test.t.a, offset:0, count:1", - " └─TableRangeScan_13 3333.33 cop[tikv] table:t range:[-inf,10), keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain select /*+ no_order_index(t, primary) */ * from t use index(primary) where a<10 order by a limit 1;", - "Plan": [ - "TopN_8 1.00 root test.t.a, offset:0, count:1", - "└─TableReader_16 1.00 root data:TopN_15", - " └─TopN_15 1.00 cop[tikv] test.t.a, offset:0, count:1", - " └─TableRangeScan_13 3333.33 cop[tikv] table:t range:[-inf,10), keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain select /*+ no_order_index(t, primary) force_index(t, primary) */ * from t where a<10 order by a limit 1;", - "Plan": [ - "TopN_8 1.00 root test.t.a, offset:0, count:1", - "└─TableReader_16 1.00 root data:TopN_15", - " └─TopN_15 1.00 cop[tikv] test.t.a, offset:0, count:1", - " └─TableRangeScan_13 3333.33 cop[tikv] table:t range:[-inf,10), keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain select /*+ no_order_index(t, primary) */ * from t force index(primary) where a<10 order by a limit 1;", - "Plan": [ - "TopN_8 1.00 root test.t.a, offset:0, count:1", - "└─TableReader_16 1.00 root data:TopN_15", - " └─TopN_15 1.00 cop[tikv] test.t.a, offset:0, count:1", - " └─TableRangeScan_13 3333.33 cop[tikv] table:t range:[-inf,10), keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain select /*+ no_order_index(t, primary) ignore_index(t, primary) */ * from t where a<10 order by a limit 1;", - "Plan": [ - "TopN_8 1.00 root test.t.a, offset:0, count:1", - "└─TableReader_15 1.00 root data:TopN_14", - " └─TopN_14 1.00 cop[tikv] test.t.a, offset:0, count:1", - " └─TableRangeScan_13 3333.33 cop[tikv] table:t range:[-inf,10), keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain select /*+ no_order_index(t1, idx_a) use_index(t1, idx_a) */ * from t1 where a<10 order by a limit 1;", - "Plan": [ - "TopN_9 1.00 root test.t1.a, offset:0, count:1", - "└─IndexLookUp_18 1.00 root ", - " ├─TopN_17(Build) 1.00 cop[tikv] test.t1.a, offset:0, count:1", - " │ └─IndexRangeScan_13 3323.33 cop[tikv] table:t1, index:idx_a(a) range:[-inf,10), keep order:false, stats:pseudo", - " └─TableRowIDScan_14(Probe) 1.00 cop[tikv] table:t1 keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain select /*+ no_order_index(t1, idx_a) */ * from t1 use index(idx_a) where a<10 order by a limit 1;", - "Plan": [ - "TopN_9 1.00 root test.t1.a, offset:0, count:1", - "└─IndexLookUp_18 1.00 root ", - " ├─TopN_17(Build) 1.00 cop[tikv] test.t1.a, offset:0, count:1", - " │ └─IndexRangeScan_13 3323.33 cop[tikv] table:t1, index:idx_a(a) range:[-inf,10), keep order:false, stats:pseudo", - " └─TableRowIDScan_14(Probe) 1.00 cop[tikv] table:t1 keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain select /*+ no_order_index(t1, idx_a) force_index(t1, idx_a) */ * from t1 where a<10 order by a limit 1;", - "Plan": [ - "TopN_9 1.00 root test.t1.a, offset:0, count:1", - "└─IndexLookUp_18 1.00 root ", - " ├─TopN_17(Build) 1.00 cop[tikv] test.t1.a, offset:0, count:1", - " │ └─IndexRangeScan_13 3323.33 cop[tikv] table:t1, index:idx_a(a) range:[-inf,10), keep order:false, stats:pseudo", - " └─TableRowIDScan_14(Probe) 1.00 cop[tikv] table:t1 keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain select /*+ no_order_index(t1, idx_a) */ * from t1 force index(idx_a) where a<10 order by a limit 1;", - "Plan": [ - "TopN_9 1.00 root test.t1.a, offset:0, count:1", - "└─IndexLookUp_18 1.00 root ", - " ├─TopN_17(Build) 1.00 cop[tikv] test.t1.a, offset:0, count:1", - " │ └─IndexRangeScan_13 3323.33 cop[tikv] table:t1, index:idx_a(a) range:[-inf,10), keep order:false, stats:pseudo", - " └─TableRowIDScan_14(Probe) 1.00 cop[tikv] table:t1 keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain select /*+ no_order_index(t1, idx_a) ignore_index(t1, idx_a) */ * from t1 where a<10 order by a limit 1;", - "Plan": [ - "TopN_8 1.00 root test.t1.a, offset:0, count:1", - "└─TableReader_16 1.00 root data:TopN_15", - " └─TopN_15 1.00 cop[tikv] test.t1.a, offset:0, count:1", - " └─Selection_14 3323.33 cop[tikv] lt(test.t1.a, 10)", - " └─TableFullScan_13 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain select /*+ qb_name(qb, v) order_index(t1@qb, idx_a) */ * from v", - "Plan": [ - "Projection_19 1.00 root test.t1.a, test.t1.b", - "└─IndexLookUp_18 1.00 root limit embedded(offset:0, count:1)", - " ├─Limit_17(Build) 1.00 cop[tikv] offset:0, count:1", - " │ └─IndexRangeScan_15 1.00 cop[tikv] table:t1, index:idx_a(a) range:[-inf,10), keep order:true, stats:pseudo", - " └─TableRowIDScan_16(Probe) 1.00 cop[tikv] table:t1 keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain select /*+ qb_name(qb, v1) order_index(t@qb, primary) */ * from v1", - "Plan": [ - "Limit_13 1.00 root offset:0, count:1", - "└─TableReader_17 1.00 root data:Limit_16", - " └─Limit_16 1.00 cop[tikv] offset:0, count:1", - " └─TableRangeScan_15 333.33 cop[tikv] table:t range:[-inf,10), keep order:true, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain select /*+ qb_name(qb, v) no_order_index(t1@qb, idx_a) */ * from v", - "Plan": [ - "TopN_11 1.00 root test.t1.a, offset:0, count:1", - "└─IndexLookUp_18 1.00 root ", - " ├─TopN_17(Build) 1.00 cop[tikv] test.t1.a, offset:0, count:1", - " │ └─IndexRangeScan_15 3323.33 cop[tikv] table:t1, index:idx_a(a) range:[-inf,10), keep order:false, stats:pseudo", - " └─TableRowIDScan_16(Probe) 1.00 cop[tikv] table:t1 keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain select /*+ qb_name(qb, v1) no_order_index(t@qb, primary) */ * from v1", - "Plan": [ - "TopN_10 1.00 root test.t.a, offset:0, count:1", - "└─TableReader_17 1.00 root data:TopN_16", - " └─TopN_16 1.00 cop[tikv] test.t.a, offset:0, count:1", - " └─TableRangeScan_15 3333.33 cop[tikv] table:t range:[-inf,10), keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain WITH CTE AS (select /*+ order_index(t1, idx_a) */ * from t1 where a<10 order by a limit 1) SELECT * FROM CTE WHERE CTE.a <18 union select * from cte where cte.b > 1;", - "Plan": [ - "HashAgg_31 2.00 root group by:Column#8, Column#9, funcs:firstrow(Column#8)->Column#8, funcs:firstrow(Column#9)->Column#9", - "└─Union_32 1.28 root ", - " ├─Selection_34 0.64 root lt(test.t1.a, 18)", - " │ └─CTEFullScan_35 0.80 root CTE:cte data:CTE_0", - " └─Selection_37 0.64 root gt(test.t1.b, 1)", - " └─CTEFullScan_38 0.80 root CTE:cte data:CTE_0", - "CTE_0 0.80 root Non-Recursive CTE", - "└─Selection_18(Seed Part) 0.80 root or(lt(test.t1.a, 18), gt(test.t1.b, 1))", - " └─Projection_29 1.00 root test.t1.a, test.t1.b", - " └─IndexLookUp_28 1.00 root limit embedded(offset:0, count:1)", - " ├─Limit_27(Build) 1.00 cop[tikv] offset:0, count:1", - " │ └─IndexRangeScan_25 1.00 cop[tikv] table:t1, index:idx_a(a) range:[-inf,10), keep order:true, stats:pseudo", - " └─TableRowIDScan_26(Probe) 1.00 cop[tikv] table:t1 keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain WITH CTE AS (select /*+ order_index(t, primary) */ * from t where a<10 order by a limit 1) SELECT * FROM CTE WHERE CTE.a <18 union select * from cte where cte.b > 1;", - "Plan": [ - "HashAgg_28 2.00 root group by:Column#7, Column#8, funcs:firstrow(Column#7)->Column#7, funcs:firstrow(Column#8)->Column#8", - "└─Union_29 1.28 root ", - " ├─Selection_31 0.64 root lt(test.t.a, 18)", - " │ └─CTEFullScan_32 0.80 root CTE:cte data:CTE_0", - " └─Selection_34 0.64 root gt(test.t.b, 1)", - " └─CTEFullScan_35 0.80 root CTE:cte data:CTE_0", - "CTE_0 0.80 root Non-Recursive CTE", - "└─Selection_18(Seed Part) 0.80 root or(lt(test.t.a, 18), gt(test.t.b, 1))", - " └─Limit_23 1.00 root offset:0, count:1", - " └─TableReader_27 1.00 root data:Limit_26", - " └─Limit_26 1.00 cop[tikv] offset:0, count:1", - " └─TableRangeScan_25 333.33 cop[tikv] table:t range:[-inf,10), keep order:true, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain WITH CTE AS (select /*+ no_order_index(t1, idx_a) */ * from t1 where a<10 order by a limit 1) SELECT * FROM CTE WHERE CTE.a <18 union select * from cte where cte.b > 1;", - "Plan": [ - "HashAgg_29 2.00 root group by:Column#8, Column#9, funcs:firstrow(Column#8)->Column#8, funcs:firstrow(Column#9)->Column#9", - "└─Union_30 1.28 root ", - " ├─Selection_32 0.64 root lt(test.t1.a, 18)", - " │ └─CTEFullScan_33 0.80 root CTE:cte data:CTE_0", - " └─Selection_35 0.64 root gt(test.t1.b, 1)", - " └─CTEFullScan_36 0.80 root CTE:cte data:CTE_0", - "CTE_0 0.80 root Non-Recursive CTE", - "└─Selection_18(Seed Part) 0.80 root or(lt(test.t1.a, 18), gt(test.t1.b, 1))", - " └─TopN_21 1.00 root test.t1.a, offset:0, count:1", - " └─IndexLookUp_28 1.00 root ", - " ├─TopN_27(Build) 1.00 cop[tikv] test.t1.a, offset:0, count:1", - " │ └─IndexRangeScan_25 3323.33 cop[tikv] table:t1, index:idx_a(a) range:[-inf,10), keep order:false, stats:pseudo", - " └─TableRowIDScan_26(Probe) 1.00 cop[tikv] table:t1 keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain WITH CTE AS (select /*+ no_order_index(t, primary) */ * from t where a<10 order by a limit 1) SELECT * FROM CTE WHERE CTE.a <18 union select * from cte where cte.b > 1;", - "Plan": [ - "HashAgg_28 2.00 root group by:Column#7, Column#8, funcs:firstrow(Column#7)->Column#7, funcs:firstrow(Column#8)->Column#8", - "└─Union_29 1.28 root ", - " ├─Selection_31 0.64 root lt(test.t.a, 18)", - " │ └─CTEFullScan_32 0.80 root CTE:cte data:CTE_0", - " └─Selection_34 0.64 root gt(test.t.b, 1)", - " └─CTEFullScan_35 0.80 root CTE:cte data:CTE_0", - "CTE_0 0.80 root Non-Recursive CTE", - "└─Selection_18(Seed Part) 0.80 root or(lt(test.t.a, 18), gt(test.t.b, 1))", - " └─TopN_20 1.00 root test.t.a, offset:0, count:1", - " └─TableReader_27 1.00 root data:TopN_26", - " └─TopN_26 1.00 cop[tikv] test.t.a, offset:0, count:1", - " └─TableRangeScan_25 3333.33 cop[tikv] table:t range:[-inf,10), keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain select /*+ order_index(th, a) */ a from th where a<1 order by a limit 1", - "Plan": [ - "Limit_11 1.00 root offset:0, count:1", - "└─IndexReader_15 1.00 root partition:all index:Limit_14", - " └─Limit_14 1.00 cop[tikv] offset:0, count:1", - " └─IndexRangeScan_13 1.00 cop[tikv] table:th, index:a(a) range:[-inf,1), keep order:true, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain select /*+ no_order_index(th, a) */ a from th where a<1 order by a limit 1", - "Plan": [ - "TopN_8 1.00 root test.th.a, offset:0, count:1", - "└─IndexReader_15 1.00 root partition:all index:TopN_14", - " └─TopN_14 1.00 cop[tikv] test.th.a, offset:0, count:1", - " └─IndexRangeScan_13 3323.33 cop[tikv] table:th, index:a(a) range:[-inf,1), keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain select /*+ order_index(thp, primary) */ a from thp where a<1 order by a limit 1", - "Plan": [ - "Limit_11 1.00 root offset:0, count:1", - "└─TableReader_15 1.00 root partition:all data:Limit_14", - " └─Limit_14 1.00 cop[tikv] offset:0, count:1", - " └─TableRangeScan_13 3333.33 cop[tikv] table:thp range:[-inf,1), keep order:true, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain select /*+ no_order_index(thp, primary) */ a from thp where a<1 order by a limit 1", - "Plan": [ - "TopN_8 1.00 root test.thp.a, offset:0, count:1", - "└─TableReader_15 1.00 root partition:all data:TopN_14", - " └─TopN_14 1.00 cop[tikv] test.thp.a, offset:0, count:1", - " └─TableRangeScan_13 3333.33 cop[tikv] table:thp range:[-inf,1), keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain select /*+ order_index(thh, a) */ * from thh where a<1 order by a limit 1", - "Plan": [ - "Projection_17 1.00 root test.thh.a, test.thh.b", - "└─IndexLookUp_16 1.00 root partition:all limit embedded(offset:0, count:1)", - " ├─Limit_15(Build) 1.00 cop[tikv] offset:0, count:1", - " │ └─IndexRangeScan_13 1.00 cop[tikv] table:thh, index:a(a) range:[-inf,1), keep order:true, stats:pseudo", - " └─TableRowIDScan_14(Probe) 1.00 cop[tikv] table:thh keep order:false, stats:pseudo" - ], - "Warn": null - } - ] - }, - { - "Name": "TestViewHint", - "Cases": [ - { - "SQL": "explain format = 'brief' select /*+ qb_name(qb_v_2, v@sel_1 .@sel_2), merge_join(t1@qb_v_2) */ * from v;", - "Plan": [ - "HashJoin 9990.00 root inner join, equal:[eq(test.t.a, Column#10)]", - "├─HashAgg(Build) 7992.00 root group by:test.t2.a, funcs:count(1)->Column#10", - "│ └─MergeJoin 12487.50 root inner join, left key:test.t1.b, right key:test.t2.b", - "│ ├─Sort(Build) 9990.00 root test.t2.b", - "│ │ └─TableReader 9990.00 root data:Selection", - "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", - "│ │ └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo", - "│ └─Sort(Probe) 9990.00 root test.t1.b", - "│ └─TableReader 9990.00 root data:Selection", - "│ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", - "│ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - "└─TableReader(Probe) 9990.00 root data:Selection", - " └─Selection 9990.00 cop[tikv] not(isnull(test.t.a))", - " └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain format = 'brief' select /*+ qb_name(qb_v_2, v@sel_1 .@sel_2), merge_join(t1@qb_v_2), stream_agg(@qb_v_2), qb_name(qb_v_1, v@sel_1 .@sel_1), merge_join(t@qb_v_1) */ * from v;", - "Plan": [ - "MergeJoin 9990.00 root inner join, left key:test.t.a, right key:Column#10", - "├─Sort(Build) 7992.00 root Column#10", - "│ └─StreamAgg 7992.00 root group by:test.t2.a, funcs:count(1)->Column#10", - "│ └─Sort 12487.50 root test.t2.a", - "│ └─MergeJoin 12487.50 root inner join, left key:test.t1.b, right key:test.t2.b", - "│ ├─Sort(Build) 9990.00 root test.t2.b", - "│ │ └─TableReader 9990.00 root data:Selection", - "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", - "│ │ └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo", - "│ └─Sort(Probe) 9990.00 root test.t1.b", - "│ └─TableReader 9990.00 root data:Selection", - "│ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", - "│ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - "└─Sort(Probe) 9990.00 root test.t.a", - " └─TableReader 9990.00 root data:Selection", - " └─Selection 9990.00 cop[tikv] not(isnull(test.t.a))", - " └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain format = 'brief' select /*+ qb_name(qb_v_2, v1@sel_1 . v@sel_2 .@sel_2), merge_join(t1@qb_v_2) */ * from v1;", - "Plan": [ - "HashJoin 9980.01 root inner join, equal:[eq(test.t.a, Column#17)]", - "├─HashAgg(Build) 7984.01 root group by:test.t.a, funcs:count(1)->Column#17", - "│ └─HashJoin 12475.01 root inner join, equal:[eq(test.t.a, Column#16)]", - "│ ├─HashAgg(Build) 7992.00 root group by:test.t2.a, funcs:count(1)->Column#16", - "│ │ └─MergeJoin 12487.50 root inner join, left key:test.t1.b, right key:test.t2.b", - "│ │ ├─Sort(Build) 9990.00 root test.t2.b", - "│ │ │ └─TableReader 9990.00 root data:Selection", - "│ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", - "│ │ │ └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo", - "│ │ └─Sort(Probe) 9990.00 root test.t1.b", - "│ │ └─TableReader 9990.00 root data:Selection", - "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", - "│ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - "│ └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t.b, test.t1.b)]", - "│ ├─TableReader(Build) 9990.00 root data:Selection", - "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", - "│ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - "│ └─TableReader(Probe) 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 keep order:false, stats:pseudo", - "└─TableReader(Probe) 9990.00 root data:Selection", - " └─Selection 9990.00 cop[tikv] not(isnull(test.t.a))", - " └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain format = 'brief' select /*+ qb_name(qb_v_2, v1@sel_1 . v@sel_2 .@sel_2), merge_join(t1@qb_v_2), stream_agg(@qb_v_2), qb_name(qb_v_1, v1@sel_1 . v@sel_2 .@sel_1), merge_join(t@qb_v_1) */ * from v1;", - "Plan": [ - "HashJoin 9980.01 root inner join, equal:[eq(test.t.a, Column#17)]", - "├─HashAgg(Build) 7984.01 root group by:test.t.a, funcs:count(1)->Column#17", - "│ └─HashJoin 12475.01 root inner join, equal:[eq(test.t.a, Column#16)]", - "│ ├─StreamAgg(Build) 7992.00 root group by:test.t2.a, funcs:count(1)->Column#16", - "│ │ └─Sort 12487.50 root test.t2.a", - "│ │ └─MergeJoin 12487.50 root inner join, left key:test.t1.b, right key:test.t2.b", - "│ │ ├─Sort(Build) 9990.00 root test.t2.b", - "│ │ │ └─TableReader 9990.00 root data:Selection", - "│ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", - "│ │ │ └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo", - "│ │ └─Sort(Probe) 9990.00 root test.t1.b", - "│ │ └─TableReader 9990.00 root data:Selection", - "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", - "│ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - "│ └─MergeJoin(Probe) 12475.01 root inner join, left key:test.t.b, right key:test.t1.b", - "│ ├─Sort(Build) 9990.00 root test.t1.b", - "│ │ └─TableReader 9990.00 root data:Selection", - "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", - "│ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - "│ └─Sort(Probe) 9980.01 root test.t.b", - "│ └─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 keep order:false, stats:pseudo", - "└─TableReader(Probe) 9990.00 root data:Selection", - " └─Selection 9990.00 cop[tikv] not(isnull(test.t.a))", - " └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain format = 'brief' select /*+ qb_name(qb_v_2, v2@sel_1 . v1@sel_2 . v@sel_2 .@sel_2), merge_join(t1@qb_v_2) */ * from v2;", - "Plan": [ - "HashJoin 9980.01 root inner join, equal:[eq(test.t.a, Column#24)]", - "├─HashAgg(Build) 7984.01 root group by:test.t.a, funcs:count(1)->Column#24", - "│ └─HashJoin 12475.01 root inner join, equal:[eq(test.t.a, Column#23)]", - "│ ├─HashAgg(Build) 7984.01 root group by:test.t.a, funcs:count(1)->Column#23", - "│ │ └─HashJoin 12475.01 root inner join, equal:[eq(test.t.a, Column#22)]", - "│ │ ├─HashAgg(Build) 7992.00 root group by:test.t2.a, funcs:count(1)->Column#22", - "│ │ │ └─MergeJoin 12487.50 root inner join, left key:test.t1.b, right key:test.t2.b", - "│ │ │ ├─Sort(Build) 9990.00 root test.t2.b", - "│ │ │ │ └─TableReader 9990.00 root data:Selection", - "│ │ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", - "│ │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo", - "│ │ │ └─Sort(Probe) 9990.00 root test.t1.b", - "│ │ │ └─TableReader 9990.00 root data:Selection", - "│ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", - "│ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - "│ │ └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t.b, test.t1.b)]", - "│ │ ├─TableReader(Build) 9990.00 root data:Selection", - "│ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", - "│ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - "│ │ └─TableReader(Probe) 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 keep order:false, stats:pseudo", - "│ └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t.b, test.t1.b)]", - "│ ├─TableReader(Build) 9990.00 root data:Selection", - "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", - "│ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - "│ └─TableReader(Probe) 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 keep order:false, stats:pseudo", - "└─TableReader(Probe) 9990.00 root data:Selection", - " └─Selection 9990.00 cop[tikv] not(isnull(test.t.a))", - " └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain format = 'brief' select /*+ qb_name(qb_v_2, v2@sel_1 . v1@sel_2 . v@sel_2 .@sel_2), merge_join(t1@qb_v_2), stream_agg(@qb_v_2), qb_name(qb_v_1, v2@sel_1 . v1@sel_2 . v@sel_2 .@sel_1), merge_join(t@qb_v_1) */ * from v2;", - "Plan": [ - "HashJoin 9980.01 root inner join, equal:[eq(test.t.a, Column#24)]", - "├─HashAgg(Build) 7984.01 root group by:test.t.a, funcs:count(1)->Column#24", - "│ └─HashJoin 12475.01 root inner join, equal:[eq(test.t.a, Column#23)]", - "│ ├─HashAgg(Build) 7984.01 root group by:test.t.a, funcs:count(1)->Column#23", - "│ │ └─HashJoin 12475.01 root inner join, equal:[eq(test.t.a, Column#22)]", - "│ │ ├─StreamAgg(Build) 7992.00 root group by:test.t2.a, funcs:count(1)->Column#22", - "│ │ │ └─Sort 12487.50 root test.t2.a", - "│ │ │ └─MergeJoin 12487.50 root inner join, left key:test.t1.b, right key:test.t2.b", - "│ │ │ ├─Sort(Build) 9990.00 root test.t2.b", - "│ │ │ │ └─TableReader 9990.00 root data:Selection", - "│ │ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", - "│ │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo", - "│ │ │ └─Sort(Probe) 9990.00 root test.t1.b", - "│ │ │ └─TableReader 9990.00 root data:Selection", - "│ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", - "│ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - "│ │ └─MergeJoin(Probe) 12475.01 root inner join, left key:test.t.b, right key:test.t1.b", - "│ │ ├─Sort(Build) 9990.00 root test.t1.b", - "│ │ │ └─TableReader 9990.00 root data:Selection", - "│ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", - "│ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - "│ │ └─Sort(Probe) 9980.01 root test.t.b", - "│ │ └─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 keep order:false, stats:pseudo", - "│ └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t.b, test.t1.b)]", - "│ ├─TableReader(Build) 9990.00 root data:Selection", - "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", - "│ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - "│ └─TableReader(Probe) 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 keep order:false, stats:pseudo", - "└─TableReader(Probe) 9990.00 root data:Selection", - " └─Selection 9990.00 cop[tikv] not(isnull(test.t.a))", - " └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain format = 'brief' select /*+ qb_name(qb_v1_2, v1@sel_1 .@sel_2), merge_join(t1@qb_v1_2) */ * from v1;", - "Plan": [ - "HashJoin 9980.01 root inner join, equal:[eq(test.t.a, Column#17)]", - "├─HashAgg(Build) 7984.01 root group by:test.t.a, funcs:count(1)->Column#17", - "│ └─HashJoin 12475.01 root inner join, equal:[eq(test.t.a, Column#16)]", - "│ ├─HashAgg(Build) 7992.00 root group by:test.t2.a, funcs:count(1)->Column#16", - "│ │ └─HashJoin 12487.50 root inner join, equal:[eq(test.t1.b, test.t2.b)]", - "│ │ ├─TableReader(Build) 9990.00 root data:Selection", - "│ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", - "│ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - "│ │ └─TableReader(Probe) 9990.00 root data:Selection", - "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", - "│ │ └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo", - "│ └─MergeJoin(Probe) 12475.01 root inner join, left key:test.t.b, right key:test.t1.b", - "│ ├─Sort(Build) 9990.00 root test.t1.b", - "│ │ └─TableReader 9990.00 root data:Selection", - "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", - "│ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - "│ └─Sort(Probe) 9980.01 root test.t.b", - "│ └─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 keep order:false, stats:pseudo", - "└─TableReader(Probe) 9990.00 root data:Selection", - " └─Selection 9990.00 cop[tikv] not(isnull(test.t.a))", - " └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain format = 'brief' select /*+ qb_name(qb_v1_2, v1@sel_1 .@sel_2), merge_join(t1@qb_v1_2), stream_agg(@qb_v1_2), qb_name(qb_v1_1, v1@sel_1 .@sel_1), merge_join(t@qb_v1_1) */ * from v1;", - "Plan": [ - "MergeJoin 9980.01 root inner join, left key:test.t.a, right key:Column#17", - "├─Sort(Build) 7984.01 root Column#17", - "│ └─StreamAgg 7984.01 root group by:test.t.a, funcs:count(1)->Column#17", - "│ └─Sort 12475.01 root test.t.a", - "│ └─HashJoin 12475.01 root inner join, equal:[eq(test.t.a, Column#16)]", - "│ ├─HashAgg(Build) 7992.00 root group by:test.t2.a, funcs:count(1)->Column#16", - "│ │ └─HashJoin 12487.50 root inner join, equal:[eq(test.t1.b, test.t2.b)]", - "│ │ ├─TableReader(Build) 9990.00 root data:Selection", - "│ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", - "│ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - "│ │ └─TableReader(Probe) 9990.00 root data:Selection", - "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", - "│ │ └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo", - "│ └─MergeJoin(Probe) 12475.01 root inner join, left key:test.t.b, right key:test.t1.b", - "│ ├─Sort(Build) 9990.00 root test.t1.b", - "│ │ └─TableReader 9990.00 root data:Selection", - "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", - "│ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - "│ └─Sort(Probe) 9980.01 root test.t.b", - "│ └─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 keep order:false, stats:pseudo", - "└─Sort(Probe) 9990.00 root test.t.a", - " └─TableReader 9990.00 root data:Selection", - " └─Selection 9990.00 cop[tikv] not(isnull(test.t.a))", - " └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain format = 'brief' select /*+ qb_name(qb_v1_2, v2@sel_1 . v1@sel_2 .@sel_2), merge_join(t1@qb_v1_2) */ * from v2;", - "Plan": [ - "HashJoin 9980.01 root inner join, equal:[eq(test.t.a, Column#24)]", - "├─HashAgg(Build) 7984.01 root group by:test.t.a, funcs:count(1)->Column#24", - "│ └─HashJoin 12475.01 root inner join, equal:[eq(test.t.a, Column#23)]", - "│ ├─HashAgg(Build) 7984.01 root group by:test.t.a, funcs:count(1)->Column#23", - "│ │ └─HashJoin 12475.01 root inner join, equal:[eq(test.t.a, Column#22)]", - "│ │ ├─HashAgg(Build) 7992.00 root group by:test.t2.a, funcs:count(1)->Column#22", - "│ │ │ └─HashJoin 12487.50 root inner join, equal:[eq(test.t1.b, test.t2.b)]", - "│ │ │ ├─TableReader(Build) 9990.00 root data:Selection", - "│ │ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", - "│ │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - "│ │ │ └─TableReader(Probe) 9990.00 root data:Selection", - "│ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", - "│ │ │ └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo", - "│ │ └─MergeJoin(Probe) 12475.01 root inner join, left key:test.t.b, right key:test.t1.b", - "│ │ ├─Sort(Build) 9990.00 root test.t1.b", - "│ │ │ └─TableReader 9990.00 root data:Selection", - "│ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", - "│ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - "│ │ └─Sort(Probe) 9980.01 root test.t.b", - "│ │ └─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 keep order:false, stats:pseudo", - "│ └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t.b, test.t1.b)]", - "│ ├─TableReader(Build) 9990.00 root data:Selection", - "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", - "│ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - "│ └─TableReader(Probe) 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 keep order:false, stats:pseudo", - "└─TableReader(Probe) 9990.00 root data:Selection", - " └─Selection 9990.00 cop[tikv] not(isnull(test.t.a))", - " └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain format = 'brief' select /*+ qb_name(qb_v1_2, v2@sel_1 . v1@sel_2 .@sel_2), merge_join(t1@qb_v1_2), stream_agg(@qb_v1_2), qb_name(qb_v1_1, v2@sel_1 . v1@sel_2 .@sel_1), merge_join(t@qb_v1_1) */ * from v2;", - "Plan": [ - "HashJoin 9980.01 root inner join, equal:[eq(test.t.a, Column#24)]", - "├─HashAgg(Build) 7984.01 root group by:test.t.a, funcs:count(1)->Column#24", - "│ └─HashJoin 12475.01 root inner join, equal:[eq(test.t.a, Column#23)]", - "│ ├─StreamAgg(Build) 7984.01 root group by:test.t.a, funcs:count(1)->Column#23", - "│ │ └─Sort 12475.01 root test.t.a", - "│ │ └─HashJoin 12475.01 root inner join, equal:[eq(test.t.a, Column#22)]", - "│ │ ├─HashAgg(Build) 7992.00 root group by:test.t2.a, funcs:count(1)->Column#22", - "│ │ │ └─HashJoin 12487.50 root inner join, equal:[eq(test.t1.b, test.t2.b)]", - "│ │ │ ├─TableReader(Build) 9990.00 root data:Selection", - "│ │ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", - "│ │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - "│ │ │ └─TableReader(Probe) 9990.00 root data:Selection", - "│ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", - "│ │ │ └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo", - "│ │ └─MergeJoin(Probe) 12475.01 root inner join, left key:test.t.b, right key:test.t1.b", - "│ │ ├─Sort(Build) 9990.00 root test.t1.b", - "│ │ │ └─TableReader 9990.00 root data:Selection", - "│ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", - "│ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - "│ │ └─Sort(Probe) 9980.01 root test.t.b", - "│ │ └─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 keep order:false, stats:pseudo", - "│ └─MergeJoin(Probe) 12475.01 root inner join, left key:test.t.b, right key:test.t1.b", - "│ ├─Sort(Build) 9990.00 root test.t1.b", - "│ │ └─TableReader 9990.00 root data:Selection", - "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", - "│ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - "│ └─Sort(Probe) 9980.01 root test.t.b", - "│ └─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 keep order:false, stats:pseudo", - "└─TableReader(Probe) 9990.00 root data:Selection", - " └─Selection 9990.00 cop[tikv] not(isnull(test.t.a))", - " └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain format = 'brief' select /*+ qb_name(qb_v2_2, v2@sel_1 .@sel_2), merge_join(t1@qb_v2_2) */ * from v2;", - "Plan": [ - "HashJoin 9980.01 root inner join, equal:[eq(test.t.a, Column#24)]", - "├─HashAgg(Build) 7984.01 root group by:test.t.a, funcs:count(1)->Column#24", - "│ └─HashJoin 12475.01 root inner join, equal:[eq(test.t.a, Column#23)]", - "│ ├─HashAgg(Build) 7984.01 root group by:test.t.a, funcs:count(1)->Column#23", - "│ │ └─HashJoin 12475.01 root inner join, equal:[eq(test.t.a, Column#22)]", - "│ │ ├─HashAgg(Build) 7992.00 root group by:test.t2.a, funcs:count(1)->Column#22", - "│ │ │ └─HashJoin 12487.50 root inner join, equal:[eq(test.t1.b, test.t2.b)]", - "│ │ │ ├─TableReader(Build) 9990.00 root data:Selection", - "│ │ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", - "│ │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - "│ │ │ └─TableReader(Probe) 9990.00 root data:Selection", - "│ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", - "│ │ │ └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo", - "│ │ └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t.b, test.t1.b)]", - "│ │ ├─TableReader(Build) 9990.00 root data:Selection", - "│ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", - "│ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - "│ │ └─TableReader(Probe) 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 keep order:false, stats:pseudo", - "│ └─MergeJoin(Probe) 12475.01 root inner join, left key:test.t.b, right key:test.t1.b", - "│ ├─Sort(Build) 9990.00 root test.t1.b", - "│ │ └─TableReader 9990.00 root data:Selection", - "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", - "│ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - "│ └─Sort(Probe) 9980.01 root test.t.b", - "│ └─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 keep order:false, stats:pseudo", - "└─TableReader(Probe) 9990.00 root data:Selection", - " └─Selection 9990.00 cop[tikv] not(isnull(test.t.a))", - " └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain format = 'brief' select /*+ qb_name(qb_v2_2, v2@sel_1 .@sel_2), merge_join(t1@qb_v2_2), stream_agg(@qb_v2_2), qb_name(qb_v2_1, v2), merge_join(t@qb_v2_1) */ * from v2;", - "Plan": [ - "MergeJoin 9980.01 root inner join, left key:test.t.a, right key:Column#24", - "├─Sort(Build) 7984.01 root Column#24", - "│ └─StreamAgg 7984.01 root group by:test.t.a, funcs:count(1)->Column#24", - "│ └─Sort 12475.01 root test.t.a", - "│ └─HashJoin 12475.01 root inner join, equal:[eq(test.t.a, Column#23)]", - "│ ├─HashAgg(Build) 7984.01 root group by:test.t.a, funcs:count(1)->Column#23", - "│ │ └─HashJoin 12475.01 root inner join, equal:[eq(test.t.a, Column#22)]", - "│ │ ├─HashAgg(Build) 7992.00 root group by:test.t2.a, funcs:count(1)->Column#22", - "│ │ │ └─HashJoin 12487.50 root inner join, equal:[eq(test.t1.b, test.t2.b)]", - "│ │ │ ├─TableReader(Build) 9990.00 root data:Selection", - "│ │ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", - "│ │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - "│ │ │ └─TableReader(Probe) 9990.00 root data:Selection", - "│ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", - "│ │ │ └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo", - "│ │ └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t.b, test.t1.b)]", - "│ │ ├─TableReader(Build) 9990.00 root data:Selection", - "│ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", - "│ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - "│ │ └─TableReader(Probe) 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 keep order:false, stats:pseudo", - "│ └─MergeJoin(Probe) 12475.01 root inner join, left key:test.t.b, right key:test.t1.b", - "│ ├─Sort(Build) 9990.00 root test.t1.b", - "│ │ └─TableReader 9990.00 root data:Selection", - "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", - "│ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - "│ └─Sort(Probe) 9980.01 root test.t.b", - "│ └─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 keep order:false, stats:pseudo", - "└─Sort(Probe) 9990.00 root test.t.a", - " └─TableReader 9990.00 root data:Selection", - " └─Selection 9990.00 cop[tikv] not(isnull(test.t.a))", - " └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo" - ], - "Warn": null - } - ] - }, - { - "Name": "TestViewHintScope", - "Cases": [ - { - "SQL": "explain format = 'brief' select /*+ qb_name(qb_v, v@sel_1 .@sel_2), qb_name(qb_v, v@sel_1 .@sel_1), merge_join(t1@qb_v) */ * from v;", - "Plan": [ - "HashJoin 9980.01 root inner join, equal:[eq(test.t.a, Column#13)]", - "├─HashAgg(Build) 7984.01 root group by:test.t2.a, funcs:count(1)->Column#13", - "│ └─HashJoin 15593.77 root inner join, equal:[eq(test.t2.a, test.t3.a)]", - "│ ├─TableReader(Build) 9990.00 root data:Selection", - "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t3.a))", - "│ │ └─TableFullScan 10000.00 cop[tikv] table:t3 keep order:false, stats:pseudo", - "│ └─MergeJoin(Probe) 12475.01 root inner join, left key:test.t2.b, right key:test.t1.b", - "│ ├─Sort(Build) 9990.00 root test.t1.b", - "│ │ └─TableReader 9990.00 root data:Selection", - "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", - "│ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - "│ └─Sort(Probe) 9980.01 root test.t2.b", - "│ └─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 keep order:false, stats:pseudo", - "└─TableReader(Probe) 9990.00 root data:Selection", - " └─Selection 9990.00 cop[tikv] not(isnull(test.t.a))", - " └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo" - ], - "Warn": [ - "Duplicate query block name qb_v for view's query block hint, only the first one is effective" - ] - }, - { - "SQL": "explain format = 'brief' select /*+ qb_name(qb_v, v1@sel_1 .v@sel_2 .@sel_2), qb_name(qb_v, v1@sel_1 .v@sel_2 .@sel_1), merge_join(t1@qb_v) */ * from v1;", - "Plan": [ - "HashJoin 9980.01 root inner join, equal:[eq(test.t.a, Column#20)]", - "├─HashAgg(Build) 7984.01 root group by:test.t.a, funcs:count(1)->Column#20", - "│ └─HashJoin 12475.01 root inner join, equal:[eq(test.t.a, Column#19)]", - "│ ├─HashAgg(Build) 7984.01 root group by:test.t2.a, funcs:count(1)->Column#19", - "│ │ └─HashJoin 15593.77 root inner join, equal:[eq(test.t2.a, test.t3.a)]", - "│ │ ├─TableReader(Build) 9990.00 root data:Selection", - "│ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t3.a))", - "│ │ │ └─TableFullScan 10000.00 cop[tikv] table:t3 keep order:false, stats:pseudo", - "│ │ └─MergeJoin(Probe) 12475.01 root inner join, left key:test.t2.b, right key:test.t1.b", - "│ │ ├─Sort(Build) 9990.00 root test.t1.b", - "│ │ │ └─TableReader 9990.00 root data:Selection", - "│ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", - "│ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - "│ │ └─Sort(Probe) 9980.01 root test.t2.b", - "│ │ └─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 keep order:false, stats:pseudo", - "│ └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t.b, test.t1.b)]", - "│ ├─TableReader(Build) 9990.00 root data:Selection", - "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", - "│ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - "│ └─TableReader(Probe) 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 keep order:false, stats:pseudo", - "└─TableReader(Probe) 9990.00 root data:Selection", - " └─Selection 9990.00 cop[tikv] not(isnull(test.t.a))", - " └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo" - ], - "Warn": [ - "Duplicate query block name qb_v for view's query block hint, only the first one is effective" - ] - }, - { - "SQL": "explain format = 'brief' select /*+ qb_name(qb_v, v2@sel_1 .v1@sel_2 .v@sel_2 .@sel_2), qb_name(qb_v, v2@sel_1 .v1@sel_2 .v@sel_2 .@sel_1), merge_join(t1@qb_v) */ * from v2;", - "Plan": [ - "HashJoin 9980.01 root inner join, equal:[eq(test.t.a, Column#27)]", - "├─HashAgg(Build) 7984.01 root group by:test.t.a, funcs:count(1)->Column#27", - "│ └─HashJoin 12475.01 root inner join, equal:[eq(test.t.a, Column#26)]", - "│ ├─HashAgg(Build) 7984.01 root group by:test.t.a, funcs:count(1)->Column#26", - "│ │ └─HashJoin 12475.01 root inner join, equal:[eq(test.t.a, Column#25)]", - "│ │ ├─HashAgg(Build) 7984.01 root group by:test.t2.a, funcs:count(1)->Column#25", - "│ │ │ └─HashJoin 15593.77 root inner join, equal:[eq(test.t2.a, test.t3.a)]", - "│ │ │ ├─TableReader(Build) 9990.00 root data:Selection", - "│ │ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t3.a))", - "│ │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t3 keep order:false, stats:pseudo", - "│ │ │ └─MergeJoin(Probe) 12475.01 root inner join, left key:test.t2.b, right key:test.t1.b", - "│ │ │ ├─Sort(Build) 9990.00 root test.t1.b", - "│ │ │ │ └─TableReader 9990.00 root data:Selection", - "│ │ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", - "│ │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - "│ │ │ └─Sort(Probe) 9980.01 root test.t2.b", - "│ │ │ └─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 keep order:false, stats:pseudo", - "│ │ └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t.b, test.t1.b)]", - "│ │ ├─TableReader(Build) 9990.00 root data:Selection", - "│ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", - "│ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - "│ │ └─TableReader(Probe) 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 keep order:false, stats:pseudo", - "│ └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t.b, test.t1.b)]", - "│ ├─TableReader(Build) 9990.00 root data:Selection", - "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", - "│ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - "│ └─TableReader(Probe) 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 keep order:false, stats:pseudo", - "└─TableReader(Probe) 9990.00 root data:Selection", - " └─Selection 9990.00 cop[tikv] not(isnull(test.t.a))", - " └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo" - ], - "Warn": [ - "Duplicate query block name qb_v for view's query block hint, only the first one is effective" - ] - }, - { - "SQL": "explain format = 'brief' select /*+ qb_name(qb_v1_2, v@sel_1 .@sel_2), merge_join(t1@qb_v1_2) */ * from v1;", - "Plan": [ - "HashJoin 9980.01 root inner join, equal:[eq(test.t.a, Column#20)]", - "├─HashAgg(Build) 7984.01 root group by:test.t.a, funcs:count(1)->Column#20", - "│ └─HashJoin 12475.01 root inner join, equal:[eq(test.t.a, Column#19)]", - "│ ├─HashAgg(Build) 7984.01 root group by:test.t2.a, funcs:count(1)->Column#19", - "│ │ └─HashJoin 15593.77 root inner join, equal:[eq(test.t2.a, test.t3.a)]", - "│ │ ├─TableReader(Build) 9990.00 root data:Selection", - "│ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t3.a))", - "│ │ │ └─TableFullScan 10000.00 cop[tikv] table:t3 keep order:false, stats:pseudo", - "│ │ └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t2.b, test.t1.b)]", - "│ │ ├─TableReader(Build) 9990.00 root data:Selection", - "│ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", - "│ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - "│ │ └─TableReader(Probe) 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 keep order:false, stats:pseudo", - "│ └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t.b, test.t1.b)]", - "│ ├─TableReader(Build) 9990.00 root data:Selection", - "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", - "│ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - "│ └─TableReader(Probe) 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 keep order:false, stats:pseudo", - "└─TableReader(Probe) 9990.00 root data:Selection", - " └─Selection 9990.00 cop[tikv] not(isnull(test.t.a))", - " └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo" - ], - "Warn": [ - "The qb_name hint qb_v1_2 is unused, please check whether the table list in the qb_name hint qb_v1_2 is correct" - ] - }, - { - "SQL": "explain format = 'brief' select /*+ qb_name(qb_v1_2, v2@sel_1 . v@sel_1 .@sel_2), merge_join(t1@qb_v1_2) */ * from v2;", - "Plan": [ - "HashJoin 9980.01 root inner join, equal:[eq(test.t.a, Column#27)]", - "├─HashAgg(Build) 7984.01 root group by:test.t.a, funcs:count(1)->Column#27", - "│ └─HashJoin 12475.01 root inner join, equal:[eq(test.t.a, Column#26)]", - "│ ├─HashAgg(Build) 7984.01 root group by:test.t.a, funcs:count(1)->Column#26", - "│ │ └─HashJoin 12475.01 root inner join, equal:[eq(test.t.a, Column#25)]", - "│ │ ├─HashAgg(Build) 7984.01 root group by:test.t2.a, funcs:count(1)->Column#25", - "│ │ │ └─HashJoin 15593.77 root inner join, equal:[eq(test.t2.a, test.t3.a)]", - "│ │ │ ├─TableReader(Build) 9990.00 root data:Selection", - "│ │ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t3.a))", - "│ │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t3 keep order:false, stats:pseudo", - "│ │ │ └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t2.b, test.t1.b)]", - "│ │ │ ├─TableReader(Build) 9990.00 root data:Selection", - "│ │ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", - "│ │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - "│ │ │ └─TableReader(Probe) 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 keep order:false, stats:pseudo", - "│ │ └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t.b, test.t1.b)]", - "│ │ ├─TableReader(Build) 9990.00 root data:Selection", - "│ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", - "│ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - "│ │ └─TableReader(Probe) 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 keep order:false, stats:pseudo", - "│ └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t.b, test.t1.b)]", - "│ ├─TableReader(Build) 9990.00 root data:Selection", - "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", - "│ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - "│ └─TableReader(Probe) 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 keep order:false, stats:pseudo", - "└─TableReader(Probe) 9990.00 root data:Selection", - " └─Selection 9990.00 cop[tikv] not(isnull(test.t.a))", - " └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo" - ], - "Warn": [ - "The qb_name hint qb_v1_2 is unused, please check whether the table list in the qb_name hint qb_v1_2 is correct" - ] - }, - { - "SQL": "explain format = 'brief' select /*+ qb_name(qb_v2_2, vv@sel_1 .@sel_2), merge_join(t1@qb_v2_2) */ * from v2 vv;", - "Plan": [ - "HashJoin 9980.01 root inner join, equal:[eq(test.t.a, Column#27)]", - "├─HashAgg(Build) 7984.01 root group by:test.t.a, funcs:count(1)->Column#27", - "│ └─HashJoin 12475.01 root inner join, equal:[eq(test.t.a, Column#26)]", - "│ ├─HashAgg(Build) 7984.01 root group by:test.t.a, funcs:count(1)->Column#26", - "│ │ └─HashJoin 12475.01 root inner join, equal:[eq(test.t.a, Column#25)]", - "│ │ ├─HashAgg(Build) 7984.01 root group by:test.t2.a, funcs:count(1)->Column#25", - "│ │ │ └─HashJoin 15593.77 root inner join, equal:[eq(test.t2.a, test.t3.a)]", - "│ │ │ ├─TableReader(Build) 9990.00 root data:Selection", - "│ │ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t3.a))", - "│ │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t3 keep order:false, stats:pseudo", - "│ │ │ └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t2.b, test.t1.b)]", - "│ │ │ ├─TableReader(Build) 9990.00 root data:Selection", - "│ │ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", - "│ │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - "│ │ │ └─TableReader(Probe) 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 keep order:false, stats:pseudo", - "│ │ └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t.b, test.t1.b)]", - "│ │ ├─TableReader(Build) 9990.00 root data:Selection", - "│ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", - "│ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - "│ │ └─TableReader(Probe) 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 keep order:false, stats:pseudo", - "│ └─MergeJoin(Probe) 12475.01 root inner join, left key:test.t.b, right key:test.t1.b", - "│ ├─Sort(Build) 9990.00 root test.t1.b", - "│ │ └─TableReader 9990.00 root data:Selection", - "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", - "│ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - "│ └─Sort(Probe) 9980.01 root test.t.b", - "│ └─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 keep order:false, stats:pseudo", - "└─TableReader(Probe) 9990.00 root data:Selection", - " └─Selection 9990.00 cop[tikv] not(isnull(test.t.a))", - " └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain format = 'brief' select /*+ qb_name(qb_v2_2, v2@sel_1 .@sel_2), merge_join(t1@qb_v2_2) */ * from v2 vv;", - "Plan": [ - "HashJoin 9980.01 root inner join, equal:[eq(test.t.a, Column#27)]", - "├─HashAgg(Build) 7984.01 root group by:test.t.a, funcs:count(1)->Column#27", - "│ └─HashJoin 12475.01 root inner join, equal:[eq(test.t.a, Column#26)]", - "│ ├─HashAgg(Build) 7984.01 root group by:test.t.a, funcs:count(1)->Column#26", - "│ │ └─HashJoin 12475.01 root inner join, equal:[eq(test.t.a, Column#25)]", - "│ │ ├─HashAgg(Build) 7984.01 root group by:test.t2.a, funcs:count(1)->Column#25", - "│ │ │ └─HashJoin 15593.77 root inner join, equal:[eq(test.t2.a, test.t3.a)]", - "│ │ │ ├─TableReader(Build) 9990.00 root data:Selection", - "│ │ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t3.a))", - "│ │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t3 keep order:false, stats:pseudo", - "│ │ │ └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t2.b, test.t1.b)]", - "│ │ │ ├─TableReader(Build) 9990.00 root data:Selection", - "│ │ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", - "│ │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - "│ │ │ └─TableReader(Probe) 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 keep order:false, stats:pseudo", - "│ │ └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t.b, test.t1.b)]", - "│ │ ├─TableReader(Build) 9990.00 root data:Selection", - "│ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", - "│ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - "│ │ └─TableReader(Probe) 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 keep order:false, stats:pseudo", - "│ └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t.b, test.t1.b)]", - "│ ├─TableReader(Build) 9990.00 root data:Selection", - "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", - "│ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - "│ └─TableReader(Probe) 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 keep order:false, stats:pseudo", - "└─TableReader(Probe) 9990.00 root data:Selection", - " └─Selection 9990.00 cop[tikv] not(isnull(test.t.a))", - " └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo" - ], - "Warn": [ - "The qb_name hint qb_v2_2 is unused, please check whether the table list in the qb_name hint qb_v2_2 is correct" - ] - }, - { - "SQL": "explain format = 'brief' select * from (select /*+ qb_name(qb_v_2, v@sel_1 .@sel_2), merge_join(t1@qb_v_2) */ * from v) t;", - "Plan": [ - "HashJoin 9980.01 root inner join, equal:[eq(test.t.a, Column#13)]", - "├─HashAgg(Build) 7984.01 root group by:test.t2.a, funcs:count(1)->Column#13", - "│ └─HashJoin 15593.77 root inner join, equal:[eq(test.t2.a, test.t3.a)]", - "│ ├─TableReader(Build) 9990.00 root data:Selection", - "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t3.a))", - "│ │ └─TableFullScan 10000.00 cop[tikv] table:t3 keep order:false, stats:pseudo", - "│ └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t2.b, test.t1.b)]", - "│ ├─TableReader(Build) 9990.00 root data:Selection", - "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", - "│ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - "│ └─TableReader(Probe) 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 keep order:false, stats:pseudo", - "└─TableReader(Probe) 9990.00 root data:Selection", - " └─Selection 9990.00 cop[tikv] not(isnull(test.t.a))", - " └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo" - ], - "Warn": [ - "The qb_name hint qb_v_2 is unused, please check whether the table list in the qb_name hint qb_v_2 is correct" - ] - }, - { - "SQL": "explain format = 'brief' select * from (select /*+ qb_name(qb_v_2, v.@sel_2), merge_join(t1@qb_v_2), stream_agg(@qb_v_2), qb_name(qb_v_1, v@sel_1 .@sel1), merge_join(t@qb_v_1) */ * from v) t;", - "Plan": [ - "HashJoin 9980.01 root inner join, equal:[eq(test.t.a, Column#13)]", - "├─StreamAgg(Build) 7984.01 root group by:test.t2.a, funcs:count(1)->Column#13", - "│ └─Sort 15593.77 root test.t2.a", - "│ └─HashJoin 15593.77 root inner join, equal:[eq(test.t2.a, test.t3.a)]", - "│ ├─TableReader(Build) 9990.00 root data:Selection", - "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t3.a))", - "│ │ └─TableFullScan 10000.00 cop[tikv] table:t3 keep order:false, stats:pseudo", - "│ └─MergeJoin(Probe) 12475.01 root inner join, left key:test.t2.b, right key:test.t1.b", - "│ ├─Sort(Build) 9990.00 root test.t1.b", - "│ │ └─TableReader 9990.00 root data:Selection", - "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", - "│ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - "│ └─Sort(Probe) 9980.01 root test.t2.b", - "│ └─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 keep order:false, stats:pseudo", - "└─TableReader(Probe) 9990.00 root data:Selection", - " └─Selection 9990.00 cop[tikv] not(isnull(test.t.a))", - " └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo" - ], - "Warn": [ - "The qb_name hint qb_v_1 is unused, please check whether the table list in the qb_name hint qb_v_1 is correct" - ] - }, - { - "SQL": "explain format = 'brief' select * from (select /*+ qb_name(qb_v_2, v1@sel_1 . v@sel_2 .@sel_2), merge_join(t1@qb_v_2) */ * from v1) t;", - "Plan": [ - "HashJoin 9980.01 root inner join, equal:[eq(test.t.a, Column#20)]", - "├─HashAgg(Build) 7984.01 root group by:test.t.a, funcs:count(1)->Column#20", - "│ └─HashJoin 12475.01 root inner join, equal:[eq(test.t.a, Column#19)]", - "│ ├─HashAgg(Build) 7984.01 root group by:test.t2.a, funcs:count(1)->Column#19", - "│ │ └─HashJoin 15593.77 root inner join, equal:[eq(test.t2.a, test.t3.a)]", - "│ │ ├─TableReader(Build) 9990.00 root data:Selection", - "│ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t3.a))", - "│ │ │ └─TableFullScan 10000.00 cop[tikv] table:t3 keep order:false, stats:pseudo", - "│ │ └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t2.b, test.t1.b)]", - "│ │ ├─TableReader(Build) 9990.00 root data:Selection", - "│ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", - "│ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - "│ │ └─TableReader(Probe) 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 keep order:false, stats:pseudo", - "│ └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t.b, test.t1.b)]", - "│ ├─TableReader(Build) 9990.00 root data:Selection", - "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", - "│ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - "│ └─TableReader(Probe) 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 keep order:false, stats:pseudo", - "└─TableReader(Probe) 9990.00 root data:Selection", - " └─Selection 9990.00 cop[tikv] not(isnull(test.t.a))", - " └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo" - ], - "Warn": [ - "The qb_name hint qb_v_2 is unused, please check whether the table list in the qb_name hint qb_v_2 is correct" - ] - }, - { - "SQL": "explain format = 'brief' select * from (select /*+ qb_name(qb_v_2, v1.v@sel_2 .@sel_2), merge_join(t1@qb_v_2), stream_agg(@qb_v_2), qb_name(qb_v_1, v1@sel_1 . v@sel_2 .@sel_1), merge_join(t@qb_v_1) */ * from v1) t;", - "Plan": [ - "HashJoin 9980.01 root inner join, equal:[eq(test.t.a, Column#20)]", - "├─HashAgg(Build) 7984.01 root group by:test.t.a, funcs:count(1)->Column#20", - "│ └─HashJoin 12475.01 root inner join, equal:[eq(test.t.a, Column#19)]", - "│ ├─StreamAgg(Build) 7984.01 root group by:test.t2.a, funcs:count(1)->Column#19", - "│ │ └─Sort 15593.77 root test.t2.a", - "│ │ └─HashJoin 15593.77 root inner join, equal:[eq(test.t2.a, test.t3.a)]", - "│ │ ├─TableReader(Build) 9990.00 root data:Selection", - "│ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t3.a))", - "│ │ │ └─TableFullScan 10000.00 cop[tikv] table:t3 keep order:false, stats:pseudo", - "│ │ └─MergeJoin(Probe) 12475.01 root inner join, left key:test.t2.b, right key:test.t1.b", - "│ │ ├─Sort(Build) 9990.00 root test.t1.b", - "│ │ │ └─TableReader 9990.00 root data:Selection", - "│ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", - "│ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - "│ │ └─Sort(Probe) 9980.01 root test.t2.b", - "│ │ └─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 keep order:false, stats:pseudo", - "│ └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t.b, test.t1.b)]", - "│ ├─TableReader(Build) 9990.00 root data:Selection", - "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", - "│ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - "│ └─TableReader(Probe) 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 keep order:false, stats:pseudo", - "└─TableReader(Probe) 9990.00 root data:Selection", - " └─Selection 9990.00 cop[tikv] not(isnull(test.t.a))", - " └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo" - ], - "Warn": [ - "The qb_name hint qb_v_1 is unused, please check whether the table list in the qb_name hint qb_v_1 is correct" - ] - }, - { - "SQL": "explain format = 'brief' select /*+ qb_name(qb_v_2, v@sel_2 .@sel_2) */ * from (select /*+ merge_join(t1@qb_v_2) */ * from v) t;", - "Plan": [ - "HashJoin 9980.01 root inner join, equal:[eq(test.t.a, Column#13)]", - "├─HashAgg(Build) 7984.01 root group by:test.t2.a, funcs:count(1)->Column#13", - "│ └─HashJoin 15593.77 root inner join, equal:[eq(test.t2.a, test.t3.a)]", - "│ ├─TableReader(Build) 9990.00 root data:Selection", - "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t3.a))", - "│ │ └─TableFullScan 10000.00 cop[tikv] table:t3 keep order:false, stats:pseudo", - "│ └─MergeJoin(Probe) 12475.01 root inner join, left key:test.t2.b, right key:test.t1.b", - "│ ├─Sort(Build) 9990.00 root test.t1.b", - "│ │ └─TableReader 9990.00 root data:Selection", - "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", - "│ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - "│ └─Sort(Probe) 9980.01 root test.t2.b", - "│ └─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 keep order:false, stats:pseudo", - "└─TableReader(Probe) 9990.00 root data:Selection", - " └─Selection 9990.00 cop[tikv] not(isnull(test.t.a))", - " └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain format = 'brief' select /*+ qb_name(qb_v_2, v@sel_2 .@sel_2), qb_name(qb_v_1, v@sel_2 .@sel1) */ * from (select /*+ merge_join(t1@qb_v_2), stream_agg(@qb_v_2), merge_join(t@qb_v_1) */ * from v) t;", - "Plan": [ - "HashJoin 9980.01 root inner join, equal:[eq(test.t.a, Column#13)]", - "├─StreamAgg(Build) 7984.01 root group by:test.t2.a, funcs:count(1)->Column#13", - "│ └─Sort 15593.77 root test.t2.a", - "│ └─HashJoin 15593.77 root inner join, equal:[eq(test.t2.a, test.t3.a)]", - "│ ├─TableReader(Build) 9990.00 root data:Selection", - "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t3.a))", - "│ │ └─TableFullScan 10000.00 cop[tikv] table:t3 keep order:false, stats:pseudo", - "│ └─MergeJoin(Probe) 12475.01 root inner join, left key:test.t2.b, right key:test.t1.b", - "│ ├─Sort(Build) 9990.00 root test.t1.b", - "│ │ └─TableReader 9990.00 root data:Selection", - "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", - "│ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - "│ └─Sort(Probe) 9980.01 root test.t2.b", - "│ └─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 keep order:false, stats:pseudo", - "└─TableReader(Probe) 9990.00 root data:Selection", - " └─Selection 9990.00 cop[tikv] not(isnull(test.t.a))", - " └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo" - ], - "Warn": [ - "The qb_name hint qb_v_1 is unused, please check whether the table list in the qb_name hint qb_v_1 is correct" - ] - }, - { - "SQL": "explain format = 'brief' select /*+ qb_name(qb_v_2, v1@sel_2 . v@sel_2 .@sel_2) */ * from (select /*+ merge_join(t1@qb_v_2) */ * from v1) t;", - "Plan": [ - "HashJoin 9980.01 root inner join, equal:[eq(test.t.a, Column#20)]", - "├─HashAgg(Build) 7984.01 root group by:test.t.a, funcs:count(1)->Column#20", - "│ └─HashJoin 12475.01 root inner join, equal:[eq(test.t.a, Column#19)]", - "│ ├─HashAgg(Build) 7984.01 root group by:test.t2.a, funcs:count(1)->Column#19", - "│ │ └─HashJoin 15593.77 root inner join, equal:[eq(test.t2.a, test.t3.a)]", - "│ │ ├─TableReader(Build) 9990.00 root data:Selection", - "│ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t3.a))", - "│ │ │ └─TableFullScan 10000.00 cop[tikv] table:t3 keep order:false, stats:pseudo", - "│ │ └─MergeJoin(Probe) 12475.01 root inner join, left key:test.t2.b, right key:test.t1.b", - "│ │ ├─Sort(Build) 9990.00 root test.t1.b", - "│ │ │ └─TableReader 9990.00 root data:Selection", - "│ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", - "│ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - "│ │ └─Sort(Probe) 9980.01 root test.t2.b", - "│ │ └─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 keep order:false, stats:pseudo", - "│ └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t.b, test.t1.b)]", - "│ ├─TableReader(Build) 9990.00 root data:Selection", - "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", - "│ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - "│ └─TableReader(Probe) 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 keep order:false, stats:pseudo", - "└─TableReader(Probe) 9990.00 root data:Selection", - " └─Selection 9990.00 cop[tikv] not(isnull(test.t.a))", - " └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain format = 'brief' select /*+ qb_name(qb_v_2, v1@sel_2 . v@sel_2 .@sel_2), qb_name(qb_v_1, v1@sel_2 . v@sel_2 .@sel_1) */ * from (select /*+ merge_join(t1@qb_v_2), stream_agg(@qb_v_2), merge_join(t@qb_v_1) */ * from v1) t;", - "Plan": [ - "HashJoin 9980.01 root inner join, equal:[eq(test.t.a, Column#20)]", - "├─HashAgg(Build) 7984.01 root group by:test.t.a, funcs:count(1)->Column#20", - "│ └─HashJoin 12475.01 root inner join, equal:[eq(test.t.a, Column#19)]", - "│ ├─StreamAgg(Build) 7984.01 root group by:test.t2.a, funcs:count(1)->Column#19", - "│ │ └─Sort 15593.77 root test.t2.a", - "│ │ └─HashJoin 15593.77 root inner join, equal:[eq(test.t2.a, test.t3.a)]", - "│ │ ├─TableReader(Build) 9990.00 root data:Selection", - "│ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t3.a))", - "│ │ │ └─TableFullScan 10000.00 cop[tikv] table:t3 keep order:false, stats:pseudo", - "│ │ └─MergeJoin(Probe) 12475.01 root inner join, left key:test.t2.b, right key:test.t1.b", - "│ │ ├─Sort(Build) 9990.00 root test.t1.b", - "│ │ │ └─TableReader 9990.00 root data:Selection", - "│ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", - "│ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - "│ │ └─Sort(Probe) 9980.01 root test.t2.b", - "│ │ └─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 keep order:false, stats:pseudo", - "│ └─MergeJoin(Probe) 12475.01 root inner join, left key:test.t.b, right key:test.t1.b", - "│ ├─Sort(Build) 9990.00 root test.t1.b", - "│ │ └─TableReader 9990.00 root data:Selection", - "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", - "│ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - "│ └─Sort(Probe) 9980.01 root test.t.b", - "│ └─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 keep order:false, stats:pseudo", - "└─TableReader(Probe) 9990.00 root data:Selection", - " └─Selection 9990.00 cop[tikv] not(isnull(test.t.a))", - " └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain format = 'brief' select /*+ qb_name(qb_v1_2, v2. v1@sel_2 .@sel_2), qb_name(qb_v1_1, v2@sel_1 . v1@sel_2 .@sel_1), merge_join(t1@qb_v1_2, t@qb_v1_1), merge_join(t1@qb_v1_2) */ * from v2;", - "Plan": [ - "HashJoin 9980.01 root inner join, equal:[eq(test.t.a, Column#27)]", - "├─HashAgg(Build) 7984.01 root group by:test.t.a, funcs:count(1)->Column#27", - "│ └─HashJoin 12475.01 root inner join, equal:[eq(test.t.a, Column#26)]", - "│ ├─HashAgg(Build) 7984.01 root group by:test.t.a, funcs:count(1)->Column#26", - "│ │ └─HashJoin 12475.01 root inner join, equal:[eq(test.t.a, Column#25)]", - "│ │ ├─HashAgg(Build) 7984.01 root group by:test.t2.a, funcs:count(1)->Column#25", - "│ │ │ └─HashJoin 15593.77 root inner join, equal:[eq(test.t2.a, test.t3.a)]", - "│ │ │ ├─TableReader(Build) 9990.00 root data:Selection", - "│ │ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t3.a))", - "│ │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t3 keep order:false, stats:pseudo", - "│ │ │ └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t2.b, test.t1.b)]", - "│ │ │ ├─TableReader(Build) 9990.00 root data:Selection", - "│ │ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", - "│ │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - "│ │ │ └─TableReader(Probe) 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 keep order:false, stats:pseudo", - "│ │ └─MergeJoin(Probe) 12475.01 root inner join, left key:test.t.b, right key:test.t1.b", - "│ │ ├─Sort(Build) 9990.00 root test.t1.b", - "│ │ │ └─TableReader 9990.00 root data:Selection", - "│ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", - "│ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - "│ │ └─Sort(Probe) 9980.01 root test.t.b", - "│ │ └─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 keep order:false, stats:pseudo", - "│ └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t.b, test.t1.b)]", - "│ ├─TableReader(Build) 9990.00 root data:Selection", - "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", - "│ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - "│ └─TableReader(Probe) 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 keep order:false, stats:pseudo", - "└─TableReader(Probe) 9990.00 root data:Selection", - " └─Selection 9990.00 cop[tikv] not(isnull(test.t.a))", - " └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo" - ], - "Warn": [ - "Only one query block name is allowed in a view hint, otherwise the hint will be invalid" - ] - }, - { - "SQL": "explain format = 'brief' select /*+ qb_name(qb_v_2, v2@sel_1 . v1@sel_2 . v@sel_2 .@sel_2), qb_name(qb_v_1, v2@sel_1 . v1@sel_2 . v@sel_2 .@sel_1), merge_join(t1@qb_v_2, t3@qb_v_2) */ * from v2;", - "Plan": [ - "HashJoin 9980.01 root inner join, equal:[eq(test.t.a, Column#27)]", - "├─HashAgg(Build) 7984.01 root group by:test.t.a, funcs:count(1)->Column#27", - "│ └─HashJoin 12475.01 root inner join, equal:[eq(test.t.a, Column#26)]", - "│ ├─HashAgg(Build) 7984.01 root group by:test.t.a, funcs:count(1)->Column#26", - "│ │ └─HashJoin 12475.01 root inner join, equal:[eq(test.t.a, Column#25)]", - "│ │ ├─HashAgg(Build) 7984.01 root group by:test.t2.a, funcs:count(1)->Column#25", - "│ │ │ └─MergeJoin 15593.77 root inner join, left key:test.t2.a, right key:test.t3.a", - "│ │ │ ├─Sort(Build) 9990.00 root test.t3.a", - "│ │ │ │ └─TableReader 9990.00 root data:Selection", - "│ │ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t3.a))", - "│ │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t3 keep order:false, stats:pseudo", - "│ │ │ └─Sort(Probe) 12475.01 root test.t2.a", - "│ │ │ └─MergeJoin 12475.01 root inner join, left key:test.t2.b, right key:test.t1.b", - "│ │ │ ├─Sort(Build) 9990.00 root test.t1.b", - "│ │ │ │ └─TableReader 9990.00 root data:Selection", - "│ │ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", - "│ │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - "│ │ │ └─Sort(Probe) 9980.01 root test.t2.b", - "│ │ │ └─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 keep order:false, stats:pseudo", - "│ │ └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t.b, test.t1.b)]", - "│ │ ├─TableReader(Build) 9990.00 root data:Selection", - "│ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", - "│ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - "│ │ └─TableReader(Probe) 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 keep order:false, stats:pseudo", - "│ └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t.b, test.t1.b)]", - "│ ├─TableReader(Build) 9990.00 root data:Selection", - "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", - "│ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - "│ └─TableReader(Probe) 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 keep order:false, stats:pseudo", - "└─TableReader(Probe) 9990.00 root data:Selection", - " └─Selection 9990.00 cop[tikv] not(isnull(test.t.a))", - " └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain format = 'brief' select /*+ qb_name(qb_v_2, v2@sel_1 . v1@sel_2 . v@sel_2 .@sel_2), qb_name(qb_v_1, v2@sel_1 . v1@sel_2 . v@sel_2 .@sel_1), merge_join(@qb_v_2 t1, t3) */ * from v2;", - "Plan": [ - "HashJoin 9980.01 root inner join, equal:[eq(test.t.a, Column#27)]", - "├─HashAgg(Build) 7984.01 root group by:test.t.a, funcs:count(1)->Column#27", - "│ └─HashJoin 12475.01 root inner join, equal:[eq(test.t.a, Column#26)]", - "│ ├─HashAgg(Build) 7984.01 root group by:test.t.a, funcs:count(1)->Column#26", - "│ │ └─HashJoin 12475.01 root inner join, equal:[eq(test.t.a, Column#25)]", - "│ │ ├─HashAgg(Build) 7984.01 root group by:test.t2.a, funcs:count(1)->Column#25", - "│ │ │ └─MergeJoin 15593.77 root inner join, left key:test.t2.a, right key:test.t3.a", - "│ │ │ ├─Sort(Build) 9990.00 root test.t3.a", - "│ │ │ │ └─TableReader 9990.00 root data:Selection", - "│ │ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t3.a))", - "│ │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t3 keep order:false, stats:pseudo", - "│ │ │ └─Sort(Probe) 12475.01 root test.t2.a", - "│ │ │ └─MergeJoin 12475.01 root inner join, left key:test.t2.b, right key:test.t1.b", - "│ │ │ ├─Sort(Build) 9990.00 root test.t1.b", - "│ │ │ │ └─TableReader 9990.00 root data:Selection", - "│ │ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", - "│ │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - "│ │ │ └─Sort(Probe) 9980.01 root test.t2.b", - "│ │ │ └─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 keep order:false, stats:pseudo", - "│ │ └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t.b, test.t1.b)]", - "│ │ ├─TableReader(Build) 9990.00 root data:Selection", - "│ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", - "│ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - "│ │ └─TableReader(Probe) 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 keep order:false, stats:pseudo", - "│ └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t.b, test.t1.b)]", - "│ ├─TableReader(Build) 9990.00 root data:Selection", - "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", - "│ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - "│ └─TableReader(Probe) 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 keep order:false, stats:pseudo", - "└─TableReader(Probe) 9990.00 root data:Selection", - " └─Selection 9990.00 cop[tikv] not(isnull(test.t.a))", - " └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain format = 'brief' select /*+ qb_name(qb_v_2, v .@sel_2), merge_join(t1@qb_v_2) */ * from v;", - "Plan": [ - "HashJoin 9980.01 root inner join, equal:[eq(test.t.a, Column#13)]", - "├─HashAgg(Build) 7984.01 root group by:test.t2.a, funcs:count(1)->Column#13", - "│ └─HashJoin 15593.77 root inner join, equal:[eq(test.t2.a, test.t3.a)]", - "│ ├─TableReader(Build) 9990.00 root data:Selection", - "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t3.a))", - "│ │ └─TableFullScan 10000.00 cop[tikv] table:t3 keep order:false, stats:pseudo", - "│ └─MergeJoin(Probe) 12475.01 root inner join, left key:test.t2.b, right key:test.t1.b", - "│ ├─Sort(Build) 9990.00 root test.t1.b", - "│ │ └─TableReader 9990.00 root data:Selection", - "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", - "│ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - "│ └─Sort(Probe) 9980.01 root test.t2.b", - "│ └─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 keep order:false, stats:pseudo", - "└─TableReader(Probe) 9990.00 root data:Selection", - " └─Selection 9990.00 cop[tikv] not(isnull(test.t.a))", - " └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain format = 'brief' select /*+ qb_name(qb_v_1, v@sel_1), merge_join(t@qb_v_1) */ * from v;", - "Plan": [ - "MergeJoin 9980.01 root inner join, left key:test.t.a, right key:Column#13", - "├─Sort(Build) 7984.01 root Column#13", - "│ └─HashAgg 7984.01 root group by:test.t2.a, funcs:count(1)->Column#13", - "│ └─HashJoin 15593.77 root inner join, equal:[eq(test.t2.a, test.t3.a)]", - "│ ├─TableReader(Build) 9990.00 root data:Selection", - "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t3.a))", - "│ │ └─TableFullScan 10000.00 cop[tikv] table:t3 keep order:false, stats:pseudo", - "│ └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t2.b, test.t1.b)]", - "│ ├─TableReader(Build) 9990.00 root data:Selection", - "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", - "│ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - "│ └─TableReader(Probe) 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 keep order:false, stats:pseudo", - "└─Sort(Probe) 9990.00 root test.t.a", - " └─TableReader 9990.00 root data:Selection", - " └─Selection 9990.00 cop[tikv] not(isnull(test.t.a))", - " └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain format = 'brief' select /*+ qb_name(qb_v_2, v1 .v@sel_2 .@sel_2), merge_join(t1@qb_v_2) */ * from v1;", - "Plan": [ - "HashJoin 9980.01 root inner join, equal:[eq(test.t.a, Column#20)]", - "├─HashAgg(Build) 7984.01 root group by:test.t.a, funcs:count(1)->Column#20", - "│ └─HashJoin 12475.01 root inner join, equal:[eq(test.t.a, Column#19)]", - "│ ├─HashAgg(Build) 7984.01 root group by:test.t2.a, funcs:count(1)->Column#19", - "│ │ └─HashJoin 15593.77 root inner join, equal:[eq(test.t2.a, test.t3.a)]", - "│ │ ├─TableReader(Build) 9990.00 root data:Selection", - "│ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t3.a))", - "│ │ │ └─TableFullScan 10000.00 cop[tikv] table:t3 keep order:false, stats:pseudo", - "│ │ └─MergeJoin(Probe) 12475.01 root inner join, left key:test.t2.b, right key:test.t1.b", - "│ │ ├─Sort(Build) 9990.00 root test.t1.b", - "│ │ │ └─TableReader 9990.00 root data:Selection", - "│ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", - "│ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - "│ │ └─Sort(Probe) 9980.01 root test.t2.b", - "│ │ └─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 keep order:false, stats:pseudo", - "│ └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t.b, test.t1.b)]", - "│ ├─TableReader(Build) 9990.00 root data:Selection", - "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", - "│ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - "│ └─TableReader(Probe) 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 keep order:false, stats:pseudo", - "└─TableReader(Probe) 9990.00 root data:Selection", - " └─Selection 9990.00 cop[tikv] not(isnull(test.t.a))", - " └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain format = 'brief' select /*+ qb_name(qb_v_1, v1 .v@sel_2), merge_join(t@qb_v_1) */ * from v1;", - "Plan": [ - "HashJoin 9980.01 root inner join, equal:[eq(test.t.a, Column#20)]", - "├─HashAgg(Build) 7984.01 root group by:test.t.a, funcs:count(1)->Column#20", - "│ └─HashJoin 12475.01 root inner join, equal:[eq(test.t.a, Column#19)]", - "│ ├─HashAgg(Build) 7984.01 root group by:test.t2.a, funcs:count(1)->Column#19", - "│ │ └─HashJoin 15593.77 root inner join, equal:[eq(test.t2.a, test.t3.a)]", - "│ │ ├─TableReader(Build) 9990.00 root data:Selection", - "│ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t3.a))", - "│ │ │ └─TableFullScan 10000.00 cop[tikv] table:t3 keep order:false, stats:pseudo", - "│ │ └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t2.b, test.t1.b)]", - "│ │ ├─TableReader(Build) 9990.00 root data:Selection", - "│ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", - "│ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - "│ │ └─TableReader(Probe) 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 keep order:false, stats:pseudo", - "│ └─MergeJoin(Probe) 12475.01 root inner join, left key:test.t.b, right key:test.t1.b", - "│ ├─Sort(Build) 9990.00 root test.t1.b", - "│ │ └─TableReader 9990.00 root data:Selection", - "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", - "│ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - "│ └─Sort(Probe) 9980.01 root test.t.b", - "│ └─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 keep order:false, stats:pseudo", - "└─TableReader(Probe) 9990.00 root data:Selection", - " └─Selection 9990.00 cop[tikv] not(isnull(test.t.a))", - " └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain format = 'brief' select /*+ merge_join(t1@qb_v_2), qb_name(qb_v_2, v@sel_1 .@sel_2) */ * from v;", - "Plan": [ - "HashJoin 9980.01 root inner join, equal:[eq(test.t.a, Column#13)]", - "├─HashAgg(Build) 7984.01 root group by:test.t2.a, funcs:count(1)->Column#13", - "│ └─HashJoin 15593.77 root inner join, equal:[eq(test.t2.a, test.t3.a)]", - "│ ├─TableReader(Build) 9990.00 root data:Selection", - "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t3.a))", - "│ │ └─TableFullScan 10000.00 cop[tikv] table:t3 keep order:false, stats:pseudo", - "│ └─MergeJoin(Probe) 12475.01 root inner join, left key:test.t2.b, right key:test.t1.b", - "│ ├─Sort(Build) 9990.00 root test.t1.b", - "│ │ └─TableReader 9990.00 root data:Selection", - "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", - "│ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - "│ └─Sort(Probe) 9980.01 root test.t2.b", - "│ └─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 keep order:false, stats:pseudo", - "└─TableReader(Probe) 9990.00 root data:Selection", - " └─Selection 9990.00 cop[tikv] not(isnull(test.t.a))", - " └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain format = 'brief' select /*+ merge_join(t@qb_v_1), stream_agg(@qb_v_2), qb_name(qb_v_2, v@sel_1 .@sel_2), qb_name(qb_v_1, v@sel_1 .@sel_1) */ * from v;", - "Plan": [ - "MergeJoin 9980.01 root inner join, left key:test.t.a, right key:Column#13", - "├─Sort(Build) 7984.01 root Column#13", - "│ └─StreamAgg 7984.01 root group by:test.t2.a, funcs:count(1)->Column#13", - "│ └─Sort 15593.77 root test.t2.a", - "│ └─HashJoin 15593.77 root inner join, equal:[eq(test.t2.a, test.t3.a)]", - "│ ├─TableReader(Build) 9990.00 root data:Selection", - "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t3.a))", - "│ │ └─TableFullScan 10000.00 cop[tikv] table:t3 keep order:false, stats:pseudo", - "│ └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t2.b, test.t1.b)]", - "│ ├─TableReader(Build) 9990.00 root data:Selection", - "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", - "│ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - "│ └─TableReader(Probe) 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 keep order:false, stats:pseudo", - "└─Sort(Probe) 9990.00 root test.t.a", - " └─TableReader 9990.00 root data:Selection", - " └─Selection 9990.00 cop[tikv] not(isnull(test.t.a))", - " └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain format = 'brief' select /*+ qb_name(qb_v3_2, v3@sel_1 .@sel_2), merge_join(t1@qb_v3_2) */ * from v3;", - "Plan": [ - "MergeJoin 9980.01 root inner join, left key:test.t.a, right key:Column#27", - "├─Sort(Build) 7984.01 root Column#27", - "│ └─StreamAgg 7984.01 root group by:test.t.a, funcs:count(1)->Column#27", - "│ └─Sort 12475.01 root test.t.a", - "│ └─HashJoin 12475.01 root inner join, equal:[eq(test.t.a, Column#26)]", - "│ ├─HashAgg(Build) 7984.01 root group by:test.t.a, funcs:count(1)->Column#26", - "│ │ └─HashJoin 12475.01 root inner join, equal:[eq(test.t.a, Column#25)]", - "│ │ ├─HashAgg(Build) 7984.01 root group by:test.t2.a, funcs:count(1)->Column#25", - "│ │ │ └─HashJoin 15593.77 root inner join, equal:[eq(test.t2.a, test.t3.a)]", - "│ │ │ ├─TableReader(Build) 9990.00 root data:Selection", - "│ │ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t3.a))", - "│ │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t3 keep order:false, stats:pseudo", - "│ │ │ └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t2.b, test.t1.b)]", - "│ │ │ ├─TableReader(Build) 9990.00 root data:Selection", - "│ │ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", - "│ │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - "│ │ │ └─TableReader(Probe) 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 keep order:false, stats:pseudo", - "│ │ └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t.b, test.t1.b)]", - "│ │ ├─TableReader(Build) 9990.00 root data:Selection", - "│ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", - "│ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - "│ │ └─TableReader(Probe) 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 keep order:false, stats:pseudo", - "│ └─MergeJoin(Probe) 12475.01 root inner join, left key:test.t.b, right key:test.t1.b", - "│ ├─Sort(Build) 9990.00 root test.t1.b", - "│ │ └─TableReader 9990.00 root data:Selection", - "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", - "│ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - "│ └─Sort(Probe) 9980.01 root test.t.b", - "│ └─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 keep order:false, stats:pseudo", - "└─Sort(Probe) 9990.00 root test.t.a", - " └─TableReader 9990.00 root data:Selection", - " └─Selection 9990.00 cop[tikv] not(isnull(test.t.a))", - " └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain format = 'brief' select /*+ qb_name(qb_v3_2, v3@sel_1 .@sel_2), merge_join(t1@qb_v3_2), hash_agg(@qb_v3_2), qb_name(qb_v3_1, v3@sel_1 .@sel_1), hash_join(t@qb_v3_1) */ * from v3;", - "Plan": [ - "HashJoin 9980.01 root inner join, equal:[eq(test.t.a, Column#27)]", - "├─HashAgg(Build) 7984.01 root group by:test.t.a, funcs:count(1)->Column#27", - "│ └─HashJoin 12475.01 root inner join, equal:[eq(test.t.a, Column#26)]", - "│ ├─HashAgg(Build) 7984.01 root group by:test.t.a, funcs:count(1)->Column#26", - "│ │ └─HashJoin 12475.01 root inner join, equal:[eq(test.t.a, Column#25)]", - "│ │ ├─HashAgg(Build) 7984.01 root group by:test.t2.a, funcs:count(1)->Column#25", - "│ │ │ └─HashJoin 15593.77 root inner join, equal:[eq(test.t2.a, test.t3.a)]", - "│ │ │ ├─TableReader(Build) 9990.00 root data:Selection", - "│ │ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t3.a))", - "│ │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t3 keep order:false, stats:pseudo", - "│ │ │ └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t2.b, test.t1.b)]", - "│ │ │ ├─TableReader(Build) 9990.00 root data:Selection", - "│ │ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", - "│ │ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - "│ │ │ └─TableReader(Probe) 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 keep order:false, stats:pseudo", - "│ │ └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t.b, test.t1.b)]", - "│ │ ├─TableReader(Build) 9990.00 root data:Selection", - "│ │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", - "│ │ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - "│ │ └─TableReader(Probe) 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 keep order:false, stats:pseudo", - "│ └─MergeJoin(Probe) 12475.01 root inner join, left key:test.t.b, right key:test.t1.b", - "│ ├─Sort(Build) 9990.00 root test.t1.b", - "│ │ └─TableReader 9990.00 root data:Selection", - "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", - "│ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - "│ └─Sort(Probe) 9980.01 root test.t.b", - "│ └─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 keep order:false, stats:pseudo", - "└─TableReader(Probe) 9990.00 root data:Selection", - " └─Selection 9990.00 cop[tikv] not(isnull(test.t.a))", - " └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo" - ], - "Warn": [ - "[planner:1815]Join hints are conflict, you can only specify one type of join", - "[planner:1815]Optimizer aggregation hints are conflicted" - ] - }, - { - "SQL": "explain with d1 as (\n select a from (\n select a from (\n select /*+ qb_name(qb, v4) use_index(t4@qb, idx_a) */ a from v4 where a < 10\n ) as t0 where a < 9\n ) as t1 where a < 8\n), d2 as (select /*+ qb_name(qb2, v4) use_index(t4@qb2, idx_b) */ a from v4 where b < 10)\n\nselect * from (select * from d1) as t0 join (select * from d2) as t1;", - "Plan": [ - "HashJoin_41 6944.44 root CARTESIAN inner join", - "├─IndexLookUp_50(Build) 83.33 root ", - "│ ├─IndexRangeScan_47(Build) 250.00 cop[tikv] table:t4, index:idx_b(b) range:(3,10), keep order:false, stats:pseudo", - "│ └─Selection_49(Probe) 83.33 cop[tikv] gt(test.t4.a, 2)", - "│ └─TableRowIDScan_48 250.00 cop[tikv] table:t4 keep order:false, stats:pseudo", - "└─IndexLookUp_46(Probe) 83.33 root ", - " ├─IndexRangeScan_43(Build) 250.00 cop[tikv] table:t4, index:idx_a(a) range:(2,8), keep order:false, stats:pseudo", - " └─Selection_45(Probe) 83.33 cop[tikv] gt(test.t4.b, 3)", - " └─TableRowIDScan_44 250.00 cop[tikv] table:t4 keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain with d1 as (\n select a from (\n select a from (\n select a from v4 where a < 10\n ) as t0 where a < 9\n ) as t1 where a < 8\n), d2 as (select a from v4 where b < 10)\n\nselect /*+ qb_name(qb, v4@sel_4) use_index(t4@qb, idx_a) qb_name(qb2, v4@sel_5) use_index(t4@qb, idx_b) */ * from (select * from d1) as t0 join (select * from d2) as t1;", - "Plan": [ - "HashJoin_41 6944.44 root CARTESIAN inner join", - "├─TableReader_53(Build) 83.33 root data:Selection_52", - "│ └─Selection_52 83.33 cop[tikv] gt(test.t4.a, 2), gt(test.t4.b, 3), lt(test.t4.b, 10)", - "│ └─TableFullScan_51 10000.00 cop[tikv] table:t4 keep order:false, stats:pseudo", - "└─IndexLookUp_46(Probe) 83.33 root ", - " ├─IndexRangeScan_43(Build) 250.00 cop[tikv] table:t4, index:idx_a(a) range:(2,8), keep order:false, stats:pseudo", - " └─Selection_45(Probe) 83.33 cop[tikv] gt(test.t4.b, 3)", - " └─TableRowIDScan_44 250.00 cop[tikv] table:t4 keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain with d1 as (\n select a from (\n select a from (\n select /*+ qb_name(qb, v5) use_index(t4@qb, idx_a) */ a from v4 where a < 10\n ) as t0 where a < 9\n ) as t1 where a < 8\n), d2 as (select /*+ qb_name(qb2, v4) use_index(t4@qb2, idx_b) */ a from v4 where b < 10)\n\nselect * from (select * from d1) as t0 join (select * from d2) as t1;", - "Plan": [ - "HashJoin_41 6944.44 root CARTESIAN inner join", - "├─IndexLookUp_57(Build) 83.33 root ", - "│ ├─IndexRangeScan_54(Build) 250.00 cop[tikv] table:t4, index:idx_b(b) range:(3,10), keep order:false, stats:pseudo", - "│ └─Selection_56(Probe) 83.33 cop[tikv] gt(test.t4.a, 2)", - "│ └─TableRowIDScan_55 250.00 cop[tikv] table:t4 keep order:false, stats:pseudo", - "└─TableReader_45(Probe) 83.33 root data:Selection_44", - " └─Selection_44 83.33 cop[tikv] gt(test.t4.a, 2), gt(test.t4.b, 3), lt(test.t4.a, 10), lt(test.t4.a, 8), lt(test.t4.a, 9)", - " └─TableFullScan_43 10000.00 cop[tikv] table:t4 keep order:false, stats:pseudo" - ], - "Warn": [ - "The qb_name hint qb is unused, please check whether the table list in the qb_name hint qb is correct" - ] - } - ] - }, - { - "Name": "TestAllViewHintType", - "Cases": [ - { - "SQL": "explain format = 'brief' select /*+ qb_name(qb_v1, v1), leading(@qb_v1 v, t2) */ * from v1;", - "Plan": [ - "HashJoin 19492.21 root inner join, equal:[eq(test.t.a, test.t1.a)]", - "├─IndexReader(Build) 10000.00 root index:IndexFullScan", - "│ └─IndexFullScan 10000.00 cop[tikv] table:t1, index:idx_a(a) keep order:false, stats:pseudo", - "└─HashJoin(Probe) 15593.77 root inner join, equal:[eq(test.t3.a, test.t.a)]", - " ├─TableReader(Build) 10000.00 root MppVersion: 2, data:ExchangeSender", - " │ └─ExchangeSender 10000.00 mpp[tiflash] ExchangeType: PassThrough", - " │ └─TableFullScan 10000.00 mpp[tiflash] table:t keep order:false, stats:pseudo", - " └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t3.b, test.t2.b)]", - " ├─TableReader(Build) 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 keep order:false, stats:pseudo", - " └─TableReader(Probe) 9990.00 root data:Selection", - " └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", - " └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo" - ], - "Warn": [ - "[planner:1815]We can only use one leading hint at most, when multiple leading hints are used, all leading hints will be invalid" - ] - }, - { - "SQL": "explain format = 'brief' select /*+ qb_name(qb_v1, v1), leading(v@qb_v1, t2@qb_v1) */ * from v1;", - "Plan": [ - "HashJoin 19492.21 root inner join, equal:[eq(test.t.a, test.t1.a)]", - "├─IndexReader(Build) 10000.00 root index:IndexFullScan", - "│ └─IndexFullScan 10000.00 cop[tikv] table:t1, index:idx_a(a) keep order:false, stats:pseudo", - "└─HashJoin(Probe) 15593.77 root inner join, equal:[eq(test.t3.a, test.t.a)]", - " ├─TableReader(Build) 10000.00 root MppVersion: 2, data:ExchangeSender", - " │ └─ExchangeSender 10000.00 mpp[tiflash] ExchangeType: PassThrough", - " │ └─TableFullScan 10000.00 mpp[tiflash] table:t keep order:false, stats:pseudo", - " └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t3.b, test.t2.b)]", - " ├─TableReader(Build) 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 keep order:false, stats:pseudo", - " └─TableReader(Probe) 9990.00 root data:Selection", - " └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", - " └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo" - ], - "Warn": [ - "[planner:1815]We can only use one leading hint at most, when multiple leading hints are used, all leading hints will be invalid" - ] - }, - { - "SQL": "explain format = 'brief' select /*+ qb_name(qb_v1, v1), leading(@qb_v1 t3, t2) */ * from v1;", - "Plan": [ - "HashJoin 19492.21 root inner join, equal:[eq(test.t.a, test.t1.a)]", - "├─IndexReader(Build) 10000.00 root index:IndexFullScan", - "│ └─IndexFullScan 10000.00 cop[tikv] table:t1, index:idx_a(a) keep order:false, stats:pseudo", - "└─HashJoin(Probe) 15593.77 root inner join, equal:[eq(test.t3.a, test.t.a)]", - " ├─TableReader(Build) 10000.00 root MppVersion: 2, data:ExchangeSender", - " │ └─ExchangeSender 10000.00 mpp[tiflash] ExchangeType: PassThrough", - " │ └─TableFullScan 10000.00 mpp[tiflash] table:t keep order:false, stats:pseudo", - " └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t3.b, test.t2.b)]", - " ├─TableReader(Build) 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 keep order:false, stats:pseudo", - " └─TableReader(Probe) 9990.00 root data:Selection", - " └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", - " └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain format = 'brief' select /*+ qb_name(qb_v1, v1), leading(t3@qb_v1, t2@qb_v1) */ * from v1;", - "Plan": [ - "HashJoin 19492.21 root inner join, equal:[eq(test.t.a, test.t1.a)]", - "├─IndexReader(Build) 10000.00 root index:IndexFullScan", - "│ └─IndexFullScan 10000.00 cop[tikv] table:t1, index:idx_a(a) keep order:false, stats:pseudo", - "└─HashJoin(Probe) 15593.77 root inner join, equal:[eq(test.t3.a, test.t.a)]", - " ├─TableReader(Build) 10000.00 root MppVersion: 2, data:ExchangeSender", - " │ └─ExchangeSender 10000.00 mpp[tiflash] ExchangeType: PassThrough", - " │ └─TableFullScan 10000.00 mpp[tiflash] table:t keep order:false, stats:pseudo", - " └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t3.b, test.t2.b)]", - " ├─TableReader(Build) 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 keep order:false, stats:pseudo", - " └─TableReader(Probe) 9990.00 root data:Selection", - " └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", - " └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain format = 'brief' select /*+ qb_name(qb_v1, v1), qb_name(qb_v, v1.v), leading(t2@qb_v1, t@qb_v) */ * from v1;", - "Plan": [ - "HashJoin 19492.21 root inner join, equal:[eq(test.t.a, test.t1.a)]", - "├─IndexReader(Build) 10000.00 root index:IndexFullScan", - "│ └─IndexFullScan 10000.00 cop[tikv] table:t1, index:idx_a(a) keep order:false, stats:pseudo", - "└─HashJoin(Probe) 15593.77 root inner join, equal:[eq(test.t3.a, test.t.a)]", - " ├─TableReader(Build) 10000.00 root MppVersion: 2, data:ExchangeSender", - " │ └─ExchangeSender 10000.00 mpp[tiflash] ExchangeType: PassThrough", - " │ └─TableFullScan 10000.00 mpp[tiflash] table:t keep order:false, stats:pseudo", - " └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t3.b, test.t2.b)]", - " ├─TableReader(Build) 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 keep order:false, stats:pseudo", - " └─TableReader(Probe) 9990.00 root data:Selection", - " └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", - " └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo" - ], - "Warn": [ - "Only one query block name is allowed in a view hint, otherwise the hint will be invalid" - ] - }, - { - "SQL": "explain format = 'brief' select /*+ qb_name(qb_v1, v1), hash_join(@qb_v1 v, t2) */ * from v1;", - "Plan": [ - "HashJoin 19492.21 root inner join, equal:[eq(test.t3.a, test.t.a)]", - "├─MergeJoin(Build) 12500.00 root inner join, left key:test.t.a, right key:test.t1.a", - "│ ├─IndexReader(Build) 10000.00 root index:IndexFullScan", - "│ │ └─IndexFullScan 10000.00 cop[tikv] table:t1, index:idx_a(a) keep order:true, stats:pseudo", - "│ └─IndexReader(Probe) 10000.00 root index:IndexFullScan", - "│ └─IndexFullScan 10000.00 cop[tikv] table:t, index:idx_a(a) keep order:true, stats:pseudo", - "└─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t3.b, test.t2.b)]", - " ├─TableReader(Build) 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 keep order:false, stats:pseudo", - " └─TableReader(Probe) 9990.00 root data:Selection", - " └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", - " └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain format = 'brief' select /*+ qb_name(qb_v1, v1), hash_join(t2@qb_v1, t3@qb_v1) */ * from v1;", - "Plan": [ - "HashJoin 19492.21 root inner join, equal:[eq(test.t.a, test.t1.a)]", - "├─IndexReader(Build) 10000.00 root index:IndexFullScan", - "│ └─IndexFullScan 10000.00 cop[tikv] table:t1, index:idx_a(a) keep order:false, stats:pseudo", - "└─HashJoin(Probe) 15593.77 root inner join, equal:[eq(test.t3.a, test.t.a)]", - " ├─TableReader(Build) 10000.00 root MppVersion: 2, data:ExchangeSender", - " │ └─ExchangeSender 10000.00 mpp[tiflash] ExchangeType: PassThrough", - " │ └─TableFullScan 10000.00 mpp[tiflash] table:t keep order:false, stats:pseudo", - " └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t3.b, test.t2.b)]", - " ├─TableReader(Build) 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 keep order:false, stats:pseudo", - " └─TableReader(Probe) 9990.00 root data:Selection", - " └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", - " └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain format = 'brief' select /*+ qb_name(qb_v1, v1), hash_join_build(@qb_v1 v) */ * from v1;", - "Plan": [ - "HashJoin 19492.21 root inner join, equal:[eq(test.t3.a, test.t.a)]", - "├─MergeJoin(Build) 12500.00 root inner join, left key:test.t.a, right key:test.t1.a", - "│ ├─IndexReader(Build) 10000.00 root index:IndexFullScan", - "│ │ └─IndexFullScan 10000.00 cop[tikv] table:t1, index:idx_a(a) keep order:true, stats:pseudo", - "│ └─IndexReader(Probe) 10000.00 root index:IndexFullScan", - "│ └─IndexFullScan 10000.00 cop[tikv] table:t, index:idx_a(a) keep order:true, stats:pseudo", - "└─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t3.b, test.t2.b)]", - " ├─TableReader(Build) 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 keep order:false, stats:pseudo", - " └─TableReader(Probe) 9990.00 root data:Selection", - " └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", - " └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain format = 'brief' select /*+ qb_name(qb_v1, v1), hash_join_build(t2@qb_v1) */ * from v1;", - "Plan": [ - "HashJoin 19492.21 root inner join, equal:[eq(test.t.a, test.t1.a)]", - "├─IndexReader(Build) 10000.00 root index:IndexFullScan", - "│ └─IndexFullScan 10000.00 cop[tikv] table:t1, index:idx_a(a) keep order:false, stats:pseudo", - "└─HashJoin(Probe) 15593.77 root inner join, equal:[eq(test.t3.a, test.t.a)]", - " ├─TableReader(Build) 10000.00 root MppVersion: 2, data:ExchangeSender", - " │ └─ExchangeSender 10000.00 mpp[tiflash] ExchangeType: PassThrough", - " │ └─TableFullScan 10000.00 mpp[tiflash] table:t keep order:false, stats:pseudo", - " └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t3.b, test.t2.b)]", - " ├─TableReader(Build) 9990.00 root data:Selection", - " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", - " │ └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo", - " └─TableReader(Probe) 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 keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain format = 'brief' select /*+ qb_name(qb_v1, v1), hash_join_build(@qb_v1 v) */ * from v1;", - "Plan": [ - "HashJoin 19492.21 root inner join, equal:[eq(test.t3.a, test.t.a)]", - "├─MergeJoin(Build) 12500.00 root inner join, left key:test.t.a, right key:test.t1.a", - "│ ├─IndexReader(Build) 10000.00 root index:IndexFullScan", - "│ │ └─IndexFullScan 10000.00 cop[tikv] table:t1, index:idx_a(a) keep order:true, stats:pseudo", - "│ └─IndexReader(Probe) 10000.00 root index:IndexFullScan", - "│ └─IndexFullScan 10000.00 cop[tikv] table:t, index:idx_a(a) keep order:true, stats:pseudo", - "└─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t3.b, test.t2.b)]", - " ├─TableReader(Build) 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 keep order:false, stats:pseudo", - " └─TableReader(Probe) 9990.00 root data:Selection", - " └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", - " └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain format = 'brief' select /*+ qb_name(qb_v1, v1), hash_join_build(t2@qb_v1) */ * from v1;", - "Plan": [ - "HashJoin 19492.21 root inner join, equal:[eq(test.t.a, test.t1.a)]", - "├─IndexReader(Build) 10000.00 root index:IndexFullScan", - "│ └─IndexFullScan 10000.00 cop[tikv] table:t1, index:idx_a(a) keep order:false, stats:pseudo", - "└─HashJoin(Probe) 15593.77 root inner join, equal:[eq(test.t3.a, test.t.a)]", - " ├─TableReader(Build) 10000.00 root MppVersion: 2, data:ExchangeSender", - " │ └─ExchangeSender 10000.00 mpp[tiflash] ExchangeType: PassThrough", - " │ └─TableFullScan 10000.00 mpp[tiflash] table:t keep order:false, stats:pseudo", - " └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t3.b, test.t2.b)]", - " ├─TableReader(Build) 9990.00 root data:Selection", - " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", - " │ └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo", - " └─TableReader(Probe) 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 keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain format = 'brief' select /*+ qb_name(qb_v1, v1), merge_join(@qb_v1 v) */ * from v1;", - "Plan": [ - "HashJoin 19492.21 root inner join, equal:[eq(test.t3.a, test.t.a)]", - "├─MergeJoin(Build) 12500.00 root inner join, left key:test.t.a, right key:test.t1.a", - "│ ├─IndexReader(Build) 10000.00 root index:IndexFullScan", - "│ │ └─IndexFullScan 10000.00 cop[tikv] table:t1, index:idx_a(a) keep order:true, stats:pseudo", - "│ └─IndexReader(Probe) 10000.00 root index:IndexFullScan", - "│ └─IndexFullScan 10000.00 cop[tikv] table:t, index:idx_a(a) keep order:true, stats:pseudo", - "└─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t3.b, test.t2.b)]", - " ├─TableReader(Build) 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 keep order:false, stats:pseudo", - " └─TableReader(Probe) 9990.00 root data:Selection", - " └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", - " └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain format = 'brief' select /*+ qb_name(qb_v1, v1), merge_join(t2@qb_v1) */ * from v1;", - "Plan": [ - "HashJoin 19492.21 root inner join, equal:[eq(test.t.a, test.t1.a)]", - "├─IndexReader(Build) 10000.00 root index:IndexFullScan", - "│ └─IndexFullScan 10000.00 cop[tikv] table:t1, index:idx_a(a) keep order:false, stats:pseudo", - "└─HashJoin(Probe) 15593.77 root inner join, equal:[eq(test.t3.a, test.t.a)]", - " ├─TableReader(Build) 10000.00 root MppVersion: 2, data:ExchangeSender", - " │ └─ExchangeSender 10000.00 mpp[tiflash] ExchangeType: PassThrough", - " │ └─TableFullScan 10000.00 mpp[tiflash] table:t keep order:false, stats:pseudo", - " └─MergeJoin(Probe) 12475.01 root inner join, left key:test.t3.b, right key:test.t2.b", - " ├─Sort(Build) 9990.00 root test.t2.b", - " │ └─TableReader 9990.00 root data:Selection", - " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", - " │ └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo", - " └─Sort(Probe) 9980.01 root test.t3.b", - " └─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 keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain format = 'brief' select /*+ qb_name(qb_v, v), INL_JOIN(@qb_v t) */ * from v;", - "Plan": [ - "IndexJoin 12500.00 root inner join, inner:IndexLookUp, outer key:test.t1.a, inner key:test.t.a, equal cond:eq(test.t1.a, test.t.a)", - "├─IndexReader(Build) 10000.00 root index:IndexFullScan", - "│ └─IndexFullScan 10000.00 cop[tikv] table:t1, index:idx_a(a) keep order:false, stats:pseudo", - "└─IndexLookUp(Probe) 12500.00 root ", - " ├─IndexRangeScan(Build) 12500.00 cop[tikv] table:t, index:idx_a(a) range: decided by [eq(test.t.a, test.t1.a)], keep order:false, stats:pseudo", - " └─TableRowIDScan(Probe) 12500.00 cop[tikv] table:t keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain format = 'brief' select /*+ qb_name(qb_v, v), INL_JOIN(t@qb_v) */ * from v;", - "Plan": [ - "IndexJoin 12500.00 root inner join, inner:IndexLookUp, outer key:test.t1.a, inner key:test.t.a, equal cond:eq(test.t1.a, test.t.a)", - "├─IndexReader(Build) 10000.00 root index:IndexFullScan", - "│ └─IndexFullScan 10000.00 cop[tikv] table:t1, index:idx_a(a) keep order:false, stats:pseudo", - "└─IndexLookUp(Probe) 12500.00 root ", - " ├─IndexRangeScan(Build) 12500.00 cop[tikv] table:t, index:idx_a(a) range: decided by [eq(test.t.a, test.t1.a)], keep order:false, stats:pseudo", - " └─TableRowIDScan(Probe) 12500.00 cop[tikv] table:t keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain format = 'brief' select /*+ qb_name(qb_v2, v2.@sel_2), hash_agg(@qb_v2) */ * from v2;", - "Plan": [ - "HashJoin 9990.00 root inner join, equal:[eq(test.t.a, Column#19)]", - "├─HashAgg(Build) 7992.00 root group by:test.t2.a, funcs:count(1)->Column#19", - "│ └─HashJoin 24365.26 root inner join, equal:[eq(test.t.a, test.t1.a)]", - "│ ├─IndexReader(Build) 10000.00 root index:IndexFullScan", - "│ │ └─IndexFullScan 10000.00 cop[tikv] table:t1, index:idx_a(a) keep order:false, stats:pseudo", - "│ └─HashJoin(Probe) 19492.21 root inner join, equal:[eq(test.t3.a, test.t.a)]", - "│ ├─TableReader(Build) 10000.00 root MppVersion: 2, data:ExchangeSender", - "│ │ └─ExchangeSender 10000.00 mpp[tiflash] ExchangeType: PassThrough", - "│ │ └─TableFullScan 10000.00 mpp[tiflash] table:t keep order:false, stats:pseudo", - "│ └─HashJoin(Probe) 15593.77 root inner join, equal:[eq(test.t2.b, test.t1.b)]", - "│ ├─TableReader(Build) 9990.00 root data:Selection", - "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", - "│ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - "│ └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t3.b, test.t2.b)]", - "│ ├─TableReader(Build) 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 keep order:false, stats:pseudo", - "│ └─TableReader(Probe) 9990.00 root data:Selection", - "│ └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", - "│ └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo", - "└─TableReader(Probe) 10000.00 root MppVersion: 2, data:ExchangeSender", - " └─ExchangeSender 10000.00 mpp[tiflash] ExchangeType: PassThrough", - " └─TableFullScan 10000.00 mpp[tiflash] table:t keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain format = 'brief' select /*+ qb_name(qb_v2, v2.@sel_2), stream_agg(@qb_v2) */ * from v2;", - "Plan": [ - "HashJoin 9990.00 root inner join, equal:[eq(test.t.a, Column#19)]", - "├─StreamAgg(Build) 7992.00 root group by:test.t2.a, funcs:count(1)->Column#19", - "│ └─Sort 24365.26 root test.t2.a", - "│ └─HashJoin 24365.26 root inner join, equal:[eq(test.t.a, test.t1.a)]", - "│ ├─IndexReader(Build) 10000.00 root index:IndexFullScan", - "│ │ └─IndexFullScan 10000.00 cop[tikv] table:t1, index:idx_a(a) keep order:false, stats:pseudo", - "│ └─HashJoin(Probe) 19492.21 root inner join, equal:[eq(test.t3.a, test.t.a)]", - "│ ├─TableReader(Build) 10000.00 root MppVersion: 2, data:ExchangeSender", - "│ │ └─ExchangeSender 10000.00 mpp[tiflash] ExchangeType: PassThrough", - "│ │ └─TableFullScan 10000.00 mpp[tiflash] table:t keep order:false, stats:pseudo", - "│ └─HashJoin(Probe) 15593.77 root inner join, equal:[eq(test.t2.b, test.t1.b)]", - "│ ├─TableReader(Build) 9990.00 root data:Selection", - "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", - "│ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - "│ └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t3.b, test.t2.b)]", - "│ ├─TableReader(Build) 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 keep order:false, stats:pseudo", - "│ └─TableReader(Probe) 9990.00 root data:Selection", - "│ └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", - "│ └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo", - "└─TableReader(Probe) 10000.00 root MppVersion: 2, data:ExchangeSender", - " └─ExchangeSender 10000.00 mpp[tiflash] ExchangeType: PassThrough", - " └─TableFullScan 10000.00 mpp[tiflash] table:t keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain format = 'brief' select /*+ qb_name(qb_v3, v3), use_index(t5@qb_v3, idx_a) */ * from v3;", - "Plan": [ - "IndexLookUp 1107.78 root ", - "├─IndexRangeScan(Build) 3333.33 cop[tikv] table:t5, index:idx_a(a) range:(1,+inf], keep order:false, stats:pseudo", - "└─Selection(Probe) 1107.78 cop[tikv] lt(test.t5.b, 2)", - " └─TableRowIDScan 3333.33 cop[tikv] table:t5 keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain format = 'brief' select /*+ qb_name(qb_v3, v3), use_index(@qb_v3 t5, idx_b) */ * from v3;", - "Plan": [ - "IndexLookUp 1107.78 root ", - "├─IndexRangeScan(Build) 3323.33 cop[tikv] table:t5, index:idx_b(b) range:[-inf,2), keep order:false, stats:pseudo", - "└─Selection(Probe) 1107.78 cop[tikv] gt(test.t5.a, 1)", - " └─TableRowIDScan 3323.33 cop[tikv] table:t5 keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain format = 'brief' select /*+ qb_name(qb_v3, v3), force_index(t5@qb_v3, idx_a) */ * from v3;", - "Plan": [ - "IndexLookUp 1107.78 root ", - "├─IndexRangeScan(Build) 3333.33 cop[tikv] table:t5, index:idx_a(a) range:(1,+inf], keep order:false, stats:pseudo", - "└─Selection(Probe) 1107.78 cop[tikv] lt(test.t5.b, 2)", - " └─TableRowIDScan 3333.33 cop[tikv] table:t5 keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain format = 'brief' select /*+ qb_name(qb_v3, v3), force_index(@qb_v3 t5, idx_b) */ * from v3;", - "Plan": [ - "IndexLookUp 1107.78 root ", - "├─IndexRangeScan(Build) 3323.33 cop[tikv] table:t5, index:idx_b(b) range:[-inf,2), keep order:false, stats:pseudo", - "└─Selection(Probe) 1107.78 cop[tikv] gt(test.t5.a, 1)", - " └─TableRowIDScan 3323.33 cop[tikv] table:t5 keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain format = 'brief' select /*+ qb_name(qb_v3, v3), ignore_index(t5@qb_v3, idx_a) */ * from v3;", - "Plan": [ - "TableReader 1107.78 root data:Selection", - "└─Selection 1107.78 cop[tikv] gt(test.t5.a, 1), lt(test.t5.b, 2)", - " └─TableFullScan 10000.00 cop[tikv] table:t5 keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain format = 'brief' select /*+ qb_name(qb_v3, v3), ignore_index(@qb_v3 t5, idx_b) */ * from v3;", - "Plan": [ - "TableReader 1107.78 root data:Selection", - "└─Selection 1107.78 cop[tikv] gt(test.t5.a, 1), lt(test.t5.b, 2)", - " └─TableFullScan 10000.00 cop[tikv] table:t5 keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain format = 'brief' select /*+ qb_name(qb_v4, v4), use_index_merge(t5@qb_v4, idx_a, idx_b) */ * from v4;", - "Plan": [ - "IndexMerge 5548.89 root type: union", - "├─IndexRangeScan(Build) 3333.33 cop[tikv] table:t5, index:idx_a(a) range:(1,+inf], keep order:false, stats:pseudo", - "├─IndexRangeScan(Build) 3323.33 cop[tikv] table:t5, index:idx_b(b) range:[-inf,2), keep order:false, stats:pseudo", - "└─TableRowIDScan(Probe) 5548.89 cop[tikv] table:t5 keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain format = 'brief' select /*+ qb_name(qb_v4, v4), use_index_merge(@qb_v4 t5, idx_b, idx_a) */ * from v4;", - "Plan": [ - "IndexMerge 5548.89 root type: union", - "├─IndexRangeScan(Build) 3333.33 cop[tikv] table:t5, index:idx_a(a) range:(1,+inf], keep order:false, stats:pseudo", - "├─IndexRangeScan(Build) 3323.33 cop[tikv] table:t5, index:idx_b(b) range:[-inf,2), keep order:false, stats:pseudo", - "└─TableRowIDScan(Probe) 5548.89 cop[tikv] table:t5 keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain format = 'brief' select /*+ qb_name(qb_v, v), READ_FROM_STORAGE(TIFLASH[t@qb_v], TIKV[t1@qb_v]) */ * from v;", - "Plan": [ - "HashJoin 12500.00 root inner join, equal:[eq(test.t.a, test.t1.a)]", - "├─IndexReader(Build) 10000.00 root index:IndexFullScan", - "│ └─IndexFullScan 10000.00 cop[tikv] table:t1, index:idx_a(a) keep order:false, stats:pseudo", - "└─TableReader(Probe) 10000.00 root MppVersion: 2, data:ExchangeSender", - " └─ExchangeSender 10000.00 mpp[tiflash] ExchangeType: PassThrough", - " └─TableFullScan 10000.00 mpp[tiflash] table:t keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain format = 'brief' select /*+ qb_name(qb_v5, v5.@sel_2), SEMI_JOIN_REWRITE(@qb_v5) */ * from v5;", - "Plan": [ - "HashJoin 9990.00 root inner join, equal:[eq(test.t.b, test.t1.b)]", - "├─HashAgg(Build) 7992.00 root group by:test.t1.b, funcs:firstrow(test.t1.b)->test.t1.b", - "│ └─TableReader 7992.00 root data:HashAgg", - "│ └─HashAgg 7992.00 cop[tikv] group by:test.t1.b, ", - "│ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", - "│ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - "└─TableReader(Probe) 9990.00 root MppVersion: 2, data:ExchangeSender", - " └─ExchangeSender 9990.00 mpp[tiflash] ExchangeType: PassThrough", - " └─Selection 9990.00 mpp[tiflash] not(isnull(test.t.b))", - " └─TableFullScan 10000.00 mpp[tiflash] table:t pushed down filter:empty, keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain format = 'brief' select /*+ qb_name(qb_v6, v6.@sel_2), NO_DECORRELATE(@qb_v6) */ * from v6;", - "Plan": [ - "Projection 10000.00 root test.t1.a, test.t1.b", - "└─Apply 10000.00 root CARTESIAN inner join, other cond:lt(cast(test.t1.a, decimal(10,0) BINARY), Column#7)", - " ├─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:sum(Column#9)->Column#7", - " └─TableReader 10000.00 root data:StreamAgg", - " └─StreamAgg 10000.00 cop[tikv] funcs:sum(test.t2.a)->Column#9", - " └─Selection 100000.00 cop[tikv] eq(test.t2.b, test.t1.b)", - " └─TableFullScan 100000000.00 cop[tikv] table:t2 keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain format = 'brief' select /*+ qb_name(qb_v7, v7), merge(@qb_v7) */ * from v7;", - "Plan": [ - "TableReader 3544.89 root MppVersion: 2, data:ExchangeSender", - "└─ExchangeSender 3544.89 mpp[tiflash] ExchangeType: PassThrough", - " └─Projection 3544.89 mpp[tiflash] Column#14, Column#15", - " └─HashAgg 3544.89 mpp[tiflash] group by:Column#14, Column#15, funcs:firstrow(Column#14)->Column#14, funcs:firstrow(Column#15)->Column#15", - " └─ExchangeReceiver 3544.89 mpp[tiflash] ", - " └─ExchangeSender 3544.89 mpp[tiflash] ExchangeType: HashPartition, Compression: FAST, Hash Cols: [name: Column#14, collate: binary], [name: Column#15, collate: binary]", - " └─HashAgg 3544.89 mpp[tiflash] group by:Column#14, Column#15, ", - " └─Union 4431.11 mpp[tiflash] ", - " ├─Projection 3323.33 mpp[tiflash] cast(test.t.a, int(11) BINARY)->Column#14, test.t.b->Column#15", - " │ └─Selection 3323.33 mpp[tiflash] lt(test.t.a, 18), lt(test.t.a, 60)", - " │ └─TableFullScan 10000.00 mpp[tiflash] table:t pushed down filter:empty, keep order:false, stats:pseudo", - " └─Projection 1107.78 mpp[tiflash] cast(test.t.a, int(11) BINARY)->Column#14, test.t.b->Column#15", - " └─Selection 1107.78 mpp[tiflash] gt(test.t.b, 1), lt(test.t.a, 60)", - " └─TableFullScan 10000.00 mpp[tiflash] table:t pushed down filter:empty, keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain format = 'brief' select /*+ qb_name(qb_v8, v8), merge(@qb_v8) */ * from v8;", - "Plan": [ - "HashAgg 16000.00 root group by:Column#21, funcs:firstrow(Column#21)->Column#21", - "└─Union 1000000010000.00 root ", - " ├─HashJoin 1000000000000.00 root CARTESIAN inner join", - " │ ├─TableReader(Build) 10000.00 root data:TableFullScan", - " │ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - " │ └─CTEFullScan(Probe) 100000000.00 root CTE:cte2 data:CTE_1", - " └─TableReader 10000.00 root data:TableFullScan", - " └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - "CTE_1 100000000.00 root Non-Recursive CTE", - "└─HashJoin(Seed Part) 100000000.00 root CARTESIAN inner join", - " ├─CTEFullScan(Build) 10000.00 root CTE:cte4 data:CTE_3", - " └─CTEFullScan(Probe) 10000.00 root CTE:cte3 data:CTE_2", - "CTE_3 10000.00 root Non-Recursive CTE", - "└─IndexReader(Seed Part) 10000.00 root index:IndexFullScan", - " └─IndexFullScan 10000.00 cop[tikv] table:t3, index:idx_a(a) keep order:false, stats:pseudo", - "CTE_2 10000.00 root Non-Recursive CTE", - "└─IndexReader(Seed Part) 10000.00 root index:IndexFullScan", - " └─IndexFullScan 10000.00 cop[tikv] table:t2, index:idx_a(a) keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain format = 'brief' select /*+ qb_name(qb_v9, v9), AGG_TO_COP(@qb_v9) */ * from v9;", - "Plan": [ - "HashAgg 1.00 root funcs:sum(Column#6)->Column#4", - "└─TableReader 1.00 root MppVersion: 2, data:ExchangeSender", - " └─ExchangeSender 1.00 mpp[tiflash] ExchangeType: PassThrough", - " └─HashAgg 1.00 mpp[tiflash] funcs:sum(Column#9)->Column#6", - " └─Projection 10000.00 mpp[tiflash] cast(test.t.a, decimal(10,0) BINARY)->Column#9", - " └─TableFullScan 10000.00 mpp[tiflash] table:t keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain format = 'brief' select /*+ qb_name(qb_v10, v10), LIMIT_TO_COP(@qb_v10) */ * from v10;", - "Plan": [ - "TopN 1.00 root test.t.b, offset:0, count:1", - "└─TableReader 1.00 root MppVersion: 2, data:ExchangeSender", - " └─ExchangeSender 1.00 mpp[tiflash] ExchangeType: PassThrough", - " └─TopN 1.00 mpp[tiflash] test.t.b, offset:0, count:1", - " └─Selection 3333.33 mpp[tiflash] gt(test.t.a, 10)", - " └─TableFullScan 10000.00 mpp[tiflash] table:t pushed down filter:empty, keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain format = 'brief' select /*+ qb_name(qb, v11) read_from_storage(tiflash[t@qb]), MPP_1PHASE_AGG(@qb) */ * from v11;", - "Plan": [ - "TableReader 8000.00 root MppVersion: 2, data:ExchangeSender", - "└─ExchangeSender 8000.00 mpp[tiflash] ExchangeType: PassThrough", - " └─Projection 8000.00 mpp[tiflash] test.t.a, Column#4", - " └─Projection 8000.00 mpp[tiflash] Column#4, test.t.a", - " └─HashAgg 8000.00 mpp[tiflash] group by:Column#7, funcs:sum(Column#5)->Column#4, funcs:firstrow(Column#6)->test.t.a", - " └─Projection 10000.00 mpp[tiflash] cast(test.t.b, decimal(10,0) BINARY)->Column#5, test.t.a->Column#6, test.t.a->Column#7", - " └─ExchangeReceiver 10000.00 mpp[tiflash] ", - " └─ExchangeSender 10000.00 mpp[tiflash] ExchangeType: HashPartition, Compression: FAST, Hash Cols: [name: test.t.a, collate: binary]", - " └─TableFullScan 10000.00 mpp[tiflash] table:t keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain format = 'brief' select /*+ qb_name(qb, v11) read_from_storage(tiflash[t@qb]), MPP_2PHASE_AGG(@qb) */ * from v11;", - "Plan": [ - "TableReader 8000.00 root MppVersion: 2, data:ExchangeSender", - "└─ExchangeSender 8000.00 mpp[tiflash] ExchangeType: PassThrough", - " └─Projection 8000.00 mpp[tiflash] test.t.a, Column#4", - " └─Projection 8000.00 mpp[tiflash] Column#4, test.t.a", - " └─HashAgg 8000.00 mpp[tiflash] group by:test.t.a, funcs:sum(Column#7)->Column#4, funcs:firstrow(test.t.a)->test.t.a", - " └─ExchangeReceiver 8000.00 mpp[tiflash] ", - " └─ExchangeSender 8000.00 mpp[tiflash] ExchangeType: HashPartition, Compression: FAST, Hash Cols: [name: test.t.a, collate: binary]", - " └─HashAgg 8000.00 mpp[tiflash] group by:Column#10, funcs:sum(Column#9)->Column#7", - " └─Projection 10000.00 mpp[tiflash] cast(test.t.b, decimal(10,0) BINARY)->Column#9, test.t.a->Column#10", - " └─TableFullScan 10000.00 mpp[tiflash] table:t keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain format = 'brief' select /*+ qb_name(qb, v12) read_from_storage(tiflash[t1@qb, t@qb]), shuffle_join(t1@qb, t@qb) */ * from v12;", - "Plan": [ - "TableReader 12500.00 root MppVersion: 2, data:ExchangeSender", - "└─ExchangeSender 12500.00 mpp[tiflash] ExchangeType: PassThrough", - " └─Projection 12500.00 mpp[tiflash] test.t.a, test.t.b", - " └─HashJoin 12500.00 mpp[tiflash] inner join, equal:[eq(test.t.a, test.t.a)]", - " ├─ExchangeReceiver(Build) 10000.00 mpp[tiflash] ", - " │ └─ExchangeSender 10000.00 mpp[tiflash] ExchangeType: HashPartition, Compression: FAST, Hash Cols: [name: test.t.a, collate: binary]", - " │ └─TableFullScan 10000.00 mpp[tiflash] table:t keep order:false, stats:pseudo", - " └─ExchangeReceiver(Probe) 10000.00 mpp[tiflash] ", - " └─ExchangeSender 10000.00 mpp[tiflash] ExchangeType: HashPartition, Compression: FAST, Hash Cols: [name: test.t.a, collate: binary]", - " └─TableFullScan 10000.00 mpp[tiflash] table:t1 keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain format = 'brief' select /*+ qb_name(qb, v12) read_from_storage(tiflash[t1@qb, t@qb]), broadcast_join(t1@qb, t@qb) */ * from v12;", - "Plan": [ - "TableReader 12500.00 root MppVersion: 2, data:ExchangeSender", - "└─ExchangeSender 12500.00 mpp[tiflash] ExchangeType: PassThrough", - " └─Projection 12500.00 mpp[tiflash] test.t.a, test.t.b", - " └─HashJoin 12500.00 mpp[tiflash] inner join, equal:[eq(test.t.a, test.t.a)]", - " ├─ExchangeReceiver(Build) 10000.00 mpp[tiflash] ", - " │ └─ExchangeSender 10000.00 mpp[tiflash] ExchangeType: Broadcast, Compression: FAST", - " │ └─TableFullScan 10000.00 mpp[tiflash] table:t keep order:false, stats:pseudo", - " └─TableFullScan(Probe) 10000.00 mpp[tiflash] table:t1 keep order:false, stats:pseudo" - ], - "Warn": null - } - ] - }, - { - "Name": "TestJoinHintCompatibility", - "Cases": [ - { - "SQL": "explain format = 'brief' select /*+ leading(t3), hash_join(t1) */ * from t1 join t2 join t3 where t1.a = t2.a and t2.b = t3.b;", - "Plan": [ - "Projection 15593.77 root test.t1.a, test.t1.b, test.t2.a, test.t2.b, test.t3.a, test.t3.b", - "└─HashJoin 15593.77 root inner join, equal:[eq(test.t2.a, test.t1.a)]", - " ├─TableReader(Build) 10000.00 root data:TableFullScan", - " │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - " └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t3.b, test.t2.b)]", - " ├─TableReader(Build) 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 keep order:false, stats:pseudo", - " └─TableReader(Probe) 9990.00 root data:Selection", - " └─Selection 9990.00 cop[tikv] not(isnull(test.t3.b))", - " └─TableFullScan 10000.00 cop[tikv] table:t3 keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain format = 'brief' select /*+ leading(t2), hash_join(t2) */ * from t1 join t2 join t3 where t1.a = t2.a and t2.b = t3.b;", - "Plan": [ - "Projection 15593.77 root test.t1.a, test.t1.b, test.t2.a, test.t2.b, test.t3.a, test.t3.b", - "└─HashJoin 15593.77 root inner join, equal:[eq(test.t2.a, test.t1.a)]", - " ├─TableReader(Build) 10000.00 root data:TableFullScan", - " │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - " └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t2.b, test.t3.b)]", - " ├─TableReader(Build) 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 keep order:false, stats:pseudo", - " └─TableReader(Probe) 9990.00 root data:Selection", - " └─Selection 9990.00 cop[tikv] not(isnull(test.t3.b))", - " └─TableFullScan 10000.00 cop[tikv] table:t3 keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain format = 'brief' select /*+ leading(t3), merge_join(t1) */ * from t1 join t2 join t3 where t1.a = t2.a and t2.b = t3.b;", - "Plan": [ - "Projection 15593.77 root test.t1.a, test.t1.b, test.t2.a, test.t2.b, test.t3.a, test.t3.b", - "└─MergeJoin 15593.77 root inner join, left key:test.t2.a, right key:test.t1.a", - " ├─Projection(Build) 10000.00 root test.t1.a, test.t1.b", - " │ └─IndexLookUp 10000.00 root ", - " │ ├─IndexFullScan(Build) 10000.00 cop[tikv] table:t1, index:idx_a(a) keep order:true, stats:pseudo", - " │ └─TableRowIDScan(Probe) 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - " └─Sort(Probe) 12475.01 root test.t2.a", - " └─HashJoin 12475.01 root inner join, equal:[eq(test.t3.b, test.t2.b)]", - " ├─TableReader(Build) 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 keep order:false, stats:pseudo", - " └─TableReader(Probe) 9990.00 root data:Selection", - " └─Selection 9990.00 cop[tikv] not(isnull(test.t3.b))", - " └─TableFullScan 10000.00 cop[tikv] table:t3 keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain format = 'brief' select /*+ leading(t2), merge_join(t2) */ * from t1 join t2 join t3 where t1.a = t2.a and t2.b = t3.b;", - "Plan": [ - "Projection 15593.77 root test.t1.a, test.t1.b, test.t2.a, test.t2.b, test.t3.a, test.t3.b", - "└─HashJoin 15593.77 root inner join, equal:[eq(test.t2.a, test.t1.a)]", - " ├─TableReader(Build) 10000.00 root data:TableFullScan", - " │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - " └─MergeJoin(Probe) 12475.01 root inner join, left key:test.t2.b, right key:test.t3.b", - " ├─Projection(Build) 9990.00 root test.t3.a, test.t3.b", - " │ └─IndexLookUp 9990.00 root ", - " │ ├─IndexFullScan(Build) 9990.00 cop[tikv] table:t3, index:idx_b(b) keep order:true, stats:pseudo", - " │ └─TableRowIDScan(Probe) 9990.00 cop[tikv] table:t3 keep order:false, stats:pseudo", - " └─Projection(Probe) 9980.01 root test.t2.a, test.t2.b", - " └─IndexLookUp 9980.01 root ", - " ├─IndexFullScan(Build) 9990.00 cop[tikv] table:t2, index:idx_b(b) keep order:true, stats:pseudo", - " └─Selection(Probe) 9980.01 cop[tikv] not(isnull(test.t2.a))", - " └─TableRowIDScan 9990.00 cop[tikv] table:t2 keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain format = 'brief' select /*+ leading(t3), inl_join(t1) */ * from t1 join t2 join t3 where t1.a = t2.a and t2.b = t3.b;", - "Plan": [ - "Projection 15593.77 root test.t1.a, test.t1.b, test.t2.a, test.t2.b, test.t3.a, test.t3.b", - "└─IndexJoin 15593.77 root inner join, inner:IndexLookUp, outer key:test.t2.a, inner key:test.t1.a, equal cond:eq(test.t2.a, test.t1.a)", - " ├─HashJoin(Build) 12475.01 root inner join, equal:[eq(test.t3.b, test.t2.b)]", - " │ ├─TableReader(Build) 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 keep order:false, stats:pseudo", - " │ └─TableReader(Probe) 9990.00 root data:Selection", - " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t3.b))", - " │ └─TableFullScan 10000.00 cop[tikv] table:t3 keep order:false, stats:pseudo", - " └─IndexLookUp(Probe) 15593.77 root ", - " ├─IndexRangeScan(Build) 15593.77 cop[tikv] table:t1, index:idx_a(a) range: decided by [eq(test.t1.a, test.t2.a)], keep order:false, stats:pseudo", - " └─TableRowIDScan(Probe) 15593.77 cop[tikv] table:t1 keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain format = 'brief' select /*+ leading(t2), inl_join(t2) */ * from t1 join t2 join t3 where t1.a = t2.a and t2.b = t3.b;", - "Plan": [ - "Projection 15593.77 root test.t1.a, test.t1.b, test.t2.a, test.t2.b, test.t3.a, test.t3.b", - "└─HashJoin 15593.77 root inner join, equal:[eq(test.t2.a, test.t1.a)]", - " ├─TableReader(Build) 10000.00 root data:TableFullScan", - " │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - " └─IndexJoin(Probe) 12475.01 root inner join, inner:IndexLookUp, outer key:test.t3.b, inner key:test.t2.b, equal cond:eq(test.t3.b, test.t2.b)", - " ├─TableReader(Build) 9990.00 root data:Selection", - " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t3.b))", - " │ └─TableFullScan 10000.00 cop[tikv] table:t3 keep order:false, stats:pseudo", - " └─IndexLookUp(Probe) 12475.01 root ", - " ├─Selection(Build) 12487.50 cop[tikv] not(isnull(test.t2.b))", - " │ └─IndexRangeScan 12500.00 cop[tikv] table:t2, index:idx_b(b) range: decided by [eq(test.t2.b, test.t3.b)], keep order:false, stats:pseudo", - " └─Selection(Probe) 12475.01 cop[tikv] not(isnull(test.t2.a))", - " └─TableRowIDScan 12487.50 cop[tikv] table:t2 keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain format = 'brief' select /*+ leading(t3), hash_join_build(t1) */ * from t1 join t2 join t3 where t1.a = t2.a and t2.b = t3.b;", - "Plan": [ - "Projection 15593.77 root test.t1.a, test.t1.b, test.t2.a, test.t2.b, test.t3.a, test.t3.b", - "└─HashJoin 15593.77 root inner join, equal:[eq(test.t2.a, test.t1.a)]", - " ├─TableReader(Build) 10000.00 root data:TableFullScan", - " │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - " └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t3.b, test.t2.b)]", - " ├─TableReader(Build) 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 keep order:false, stats:pseudo", - " └─TableReader(Probe) 9990.00 root data:Selection", - " └─Selection 9990.00 cop[tikv] not(isnull(test.t3.b))", - " └─TableFullScan 10000.00 cop[tikv] table:t3 keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain format = 'brief' select /*+ leading(t2), hash_join_build(t2) */ * from t1 join t2 join t3 where t1.a = t2.a and t2.b = t3.b;", - "Plan": [ - "Projection 15593.77 root test.t1.a, test.t1.b, test.t2.a, test.t2.b, test.t3.a, test.t3.b", - "└─HashJoin 15593.77 root inner join, equal:[eq(test.t2.a, test.t1.a)]", - " ├─TableReader(Build) 10000.00 root data:TableFullScan", - " │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - " └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t2.b, test.t3.b)]", - " ├─TableReader(Build) 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 keep order:false, stats:pseudo", - " └─TableReader(Probe) 9990.00 root data:Selection", - " └─Selection 9990.00 cop[tikv] not(isnull(test.t3.b))", - " └─TableFullScan 10000.00 cop[tikv] table:t3 keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain format = 'brief' select /*+ leading(t3), hash_join_probe(t1) */ * from t1 join t2 join t3 where t1.a = t2.a and t2.b = t3.b;", - "Plan": [ - "Projection 15593.77 root test.t1.a, test.t1.b, test.t2.a, test.t2.b, test.t3.a, test.t3.b", - "└─HashJoin 15593.77 root inner join, equal:[eq(test.t2.a, test.t1.a)]", - " ├─HashJoin(Build) 12475.01 root inner join, equal:[eq(test.t3.b, test.t2.b)]", - " │ ├─TableReader(Build) 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 keep order:false, stats:pseudo", - " │ └─TableReader(Probe) 9990.00 root data:Selection", - " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t3.b))", - " │ └─TableFullScan 10000.00 cop[tikv] table:t3 keep order:false, stats:pseudo", - " └─TableReader(Probe) 10000.00 root data:TableFullScan", - " └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain format = 'brief' select /*+ leading(t2), hash_join_probe(t2) */ * from t1 join t2 join t3 where t1.a = t2.a and t2.b = t3.b;", - "Plan": [ - "Projection 15593.77 root test.t1.a, test.t1.b, test.t2.a, test.t2.b, test.t3.a, test.t3.b", - "└─HashJoin 15593.77 root inner join, equal:[eq(test.t2.a, test.t1.a)]", - " ├─TableReader(Build) 10000.00 root data:TableFullScan", - " │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - " └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t2.b, test.t3.b)]", - " ├─TableReader(Build) 9990.00 root data:Selection", - " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t3.b))", - " │ └─TableFullScan 10000.00 cop[tikv] table:t3 keep order:false, stats:pseudo", - " └─TableReader(Probe) 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 keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain format = 'brief' select /*+ leading(t6), shuffle_join(t4) */ * from t4 join t5 join t6 where t4.a = t5.a and t5.b = t6.b;", - "Plan": [ - "TableReader 15593.77 root MppVersion: 2, data:ExchangeSender", - "└─ExchangeSender 15593.77 mpp[tiflash] ExchangeType: PassThrough", - " └─Projection 15593.77 mpp[tiflash] test.t4.a, test.t4.b, test.t5.a, test.t5.b, test.t6.a, test.t6.b", - " └─HashJoin 15593.77 mpp[tiflash] inner join, equal:[eq(test.t5.a, test.t4.a)]", - " ├─ExchangeReceiver(Build) 9990.00 mpp[tiflash] ", - " │ └─ExchangeSender 9990.00 mpp[tiflash] ExchangeType: HashPartition, Compression: FAST, Hash Cols: [name: test.t4.a, collate: binary]", - " │ └─Selection 9990.00 mpp[tiflash] not(isnull(test.t4.a))", - " │ └─TableFullScan 10000.00 mpp[tiflash] table:t4 pushed down filter:empty, keep order:false, stats:pseudo", - " └─ExchangeReceiver(Probe) 12475.01 mpp[tiflash] ", - " └─ExchangeSender 12475.01 mpp[tiflash] ExchangeType: HashPartition, Compression: FAST, Hash Cols: [name: test.t5.a, collate: binary]", - " └─HashJoin 12475.01 mpp[tiflash] inner join, equal:[eq(test.t6.b, test.t5.b)]", - " ├─ExchangeReceiver(Build) 9980.01 mpp[tiflash] ", - " │ └─ExchangeSender 9980.01 mpp[tiflash] ExchangeType: Broadcast, Compression: FAST", - " │ └─Selection 9980.01 mpp[tiflash] not(isnull(test.t5.a)), not(isnull(test.t5.b))", - " │ └─TableFullScan 10000.00 mpp[tiflash] table:t5 pushed down filter:empty, keep order:false, stats:pseudo", - " └─Selection(Probe) 9990.00 mpp[tiflash] not(isnull(test.t6.b))", - " └─TableFullScan 10000.00 mpp[tiflash] table:t6 pushed down filter:empty, keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain format = 'brief' select /*+ leading(t5), shuffle_join(t5) */ * from t4 join t5 join t6 where t4.a = t5.a and t5.b = t6.b;", - "Plan": [ - "TableReader 15593.77 root MppVersion: 2, data:ExchangeSender", - "└─ExchangeSender 15593.77 mpp[tiflash] ExchangeType: PassThrough", - " └─Projection 15593.77 mpp[tiflash] test.t4.a, test.t4.b, test.t5.a, test.t5.b, test.t6.a, test.t6.b", - " └─HashJoin 15593.77 mpp[tiflash] inner join, equal:[eq(test.t5.b, test.t6.b)]", - " ├─ExchangeReceiver(Build) 9990.00 mpp[tiflash] ", - " │ └─ExchangeSender 9990.00 mpp[tiflash] ExchangeType: Broadcast, Compression: FAST", - " │ └─Selection 9990.00 mpp[tiflash] not(isnull(test.t6.b))", - " │ └─TableFullScan 10000.00 mpp[tiflash] table:t6 pushed down filter:empty, keep order:false, stats:pseudo", - " └─HashJoin(Probe) 12475.01 mpp[tiflash] inner join, equal:[eq(test.t5.a, test.t4.a)]", - " ├─ExchangeReceiver(Build) 9980.01 mpp[tiflash] ", - " │ └─ExchangeSender 9980.01 mpp[tiflash] ExchangeType: HashPartition, Compression: FAST, Hash Cols: [name: test.t5.a, collate: binary]", - " │ └─Selection 9980.01 mpp[tiflash] not(isnull(test.t5.a)), not(isnull(test.t5.b))", - " │ └─TableFullScan 10000.00 mpp[tiflash] table:t5 pushed down filter:empty, keep order:false, stats:pseudo", - " └─ExchangeReceiver(Probe) 9990.00 mpp[tiflash] ", - " └─ExchangeSender 9990.00 mpp[tiflash] ExchangeType: HashPartition, Compression: FAST, Hash Cols: [name: test.t4.a, collate: binary]", - " └─Selection 9990.00 mpp[tiflash] not(isnull(test.t4.a))", - " └─TableFullScan 10000.00 mpp[tiflash] table:t4 pushed down filter:empty, keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain format = 'brief' select /*+ leading(t6), broadcast_join(t4) */ * from t4 join t5 join t6 where t4.a = t5.a and t5.b = t6.b;", - "Plan": [ - "TableReader 15593.77 root MppVersion: 2, data:ExchangeSender", - "└─ExchangeSender 15593.77 mpp[tiflash] ExchangeType: PassThrough", - " └─Projection 15593.77 mpp[tiflash] test.t4.a, test.t4.b, test.t5.a, test.t5.b, test.t6.a, test.t6.b", - " └─HashJoin 15593.77 mpp[tiflash] inner join, equal:[eq(test.t5.a, test.t4.a)]", - " ├─ExchangeReceiver(Build) 9990.00 mpp[tiflash] ", - " │ └─ExchangeSender 9990.00 mpp[tiflash] ExchangeType: Broadcast, Compression: FAST", - " │ └─Selection 9990.00 mpp[tiflash] not(isnull(test.t4.a))", - " │ └─TableFullScan 10000.00 mpp[tiflash] table:t4 pushed down filter:empty, keep order:false, stats:pseudo", - " └─HashJoin(Probe) 12475.01 mpp[tiflash] inner join, equal:[eq(test.t6.b, test.t5.b)]", - " ├─ExchangeReceiver(Build) 9980.01 mpp[tiflash] ", - " │ └─ExchangeSender 9980.01 mpp[tiflash] ExchangeType: Broadcast, Compression: FAST", - " │ └─Selection 9980.01 mpp[tiflash] not(isnull(test.t5.a)), not(isnull(test.t5.b))", - " │ └─TableFullScan 10000.00 mpp[tiflash] table:t5 pushed down filter:empty, keep order:false, stats:pseudo", - " └─Selection(Probe) 9990.00 mpp[tiflash] not(isnull(test.t6.b))", - " └─TableFullScan 10000.00 mpp[tiflash] table:t6 pushed down filter:empty, keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain format = 'brief' select /*+ leading(t5), broadcast_join(t5) */ * from t4 join t5 join t6 where t4.a = t5.a and t5.b = t6.b;", - "Plan": [ - "TableReader 15593.77 root MppVersion: 2, data:ExchangeSender", - "└─ExchangeSender 15593.77 mpp[tiflash] ExchangeType: PassThrough", - " └─Projection 15593.77 mpp[tiflash] test.t4.a, test.t4.b, test.t5.a, test.t5.b, test.t6.a, test.t6.b", - " └─HashJoin 15593.77 mpp[tiflash] inner join, equal:[eq(test.t5.b, test.t6.b)]", - " ├─ExchangeReceiver(Build) 9990.00 mpp[tiflash] ", - " │ └─ExchangeSender 9990.00 mpp[tiflash] ExchangeType: Broadcast, Compression: FAST", - " │ └─Selection 9990.00 mpp[tiflash] not(isnull(test.t6.b))", - " │ └─TableFullScan 10000.00 mpp[tiflash] table:t6 pushed down filter:empty, keep order:false, stats:pseudo", - " └─HashJoin(Probe) 12475.01 mpp[tiflash] inner join, equal:[eq(test.t5.a, test.t4.a)]", - " ├─ExchangeReceiver(Build) 9980.01 mpp[tiflash] ", - " │ └─ExchangeSender 9980.01 mpp[tiflash] ExchangeType: Broadcast, Compression: FAST", - " │ └─Selection 9980.01 mpp[tiflash] not(isnull(test.t5.a)), not(isnull(test.t5.b))", - " │ └─TableFullScan 10000.00 mpp[tiflash] table:t5 pushed down filter:empty, keep order:false, stats:pseudo", - " └─Selection(Probe) 9990.00 mpp[tiflash] not(isnull(test.t4.a))", - " └─TableFullScan 10000.00 mpp[tiflash] table:t4 pushed down filter:empty, keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain format = 'brief' select /*+ leading(t3), hash_join(t1) */ * from t1 join t2 on t1.a = t2.a left join t3 on t2.b = t3.b;", - "Plan": [ - "Projection 15609.38 root test.t1.a, test.t1.b, test.t2.a, test.t2.b, test.t3.a, test.t3.b", - "└─HashJoin 15609.38 root inner join, equal:[eq(test.t2.a, test.t1.a)]", - " ├─TableReader(Build) 10000.00 root data:TableFullScan", - " │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - " └─HashJoin(Probe) 12487.50 root left outer join, equal:[eq(test.t2.b, test.t3.b)]", - " ├─TableReader(Build) 9990.00 root data:Selection", - " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t3.b))", - " │ └─TableFullScan 10000.00 cop[tikv] table:t3 keep order:false, stats:pseudo", - " └─TableReader(Probe) 9990.00 root data:Selection", - " └─Selection 9990.00 cop[tikv] not(isnull(test.t2.a))", - " └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain format = 'brief' select /*+ leading(t2), hash_join(t2) */ * from t1 join t2 on t1.a = t2.a left join t3 on t2.b = t3.b;", - "Plan": [ - "Projection 15609.38 root test.t1.a, test.t1.b, test.t2.a, test.t2.b, test.t3.a, test.t3.b", - "└─HashJoin 15609.38 root inner join, equal:[eq(test.t2.a, test.t1.a)]", - " ├─TableReader(Build) 10000.00 root data:TableFullScan", - " │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - " └─HashJoin(Probe) 12487.50 root left outer join, equal:[eq(test.t2.b, test.t3.b)]", - " ├─TableReader(Build) 9990.00 root data:Selection", - " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t3.b))", - " │ └─TableFullScan 10000.00 cop[tikv] table:t3 keep order:false, stats:pseudo", - " └─TableReader(Probe) 9990.00 root data:Selection", - " └─Selection 9990.00 cop[tikv] not(isnull(test.t2.a))", - " └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain format = 'brief' select /*+ leading(t3), merge_join(t1) */ * from t1 right join t2 on t1.a = t2.a join t3 on t2.b = t3.b;", - "Plan": [ - "Projection 15609.38 root test.t1.a, test.t1.b, test.t2.a, test.t2.b, test.t3.a, test.t3.b", - "└─MergeJoin 15609.38 root right outer join, left key:test.t1.a, right key:test.t2.a", - " ├─Projection(Build) 10000.00 root test.t1.a, test.t1.b", - " │ └─IndexLookUp 10000.00 root ", - " │ ├─IndexFullScan(Build) 10000.00 cop[tikv] table:t1, index:idx_a(a) keep order:true, stats:pseudo", - " │ └─TableRowIDScan(Probe) 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - " └─Sort(Probe) 12487.50 root test.t2.a", - " └─HashJoin 12487.50 root inner join, equal:[eq(test.t3.b, test.t2.b)]", - " ├─TableReader(Build) 9990.00 root data:Selection", - " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", - " │ └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo", - " └─TableReader(Probe) 9990.00 root data:Selection", - " └─Selection 9990.00 cop[tikv] not(isnull(test.t3.b))", - " └─TableFullScan 10000.00 cop[tikv] table:t3 keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain format = 'brief' select /*+ leading(t2), merge_join(t2) */ * from t1 right join t2 on t1.a = t2.a join t3 on t2.b = t3.b;", - "Plan": [ - "HashJoin 15609.38 root right outer join, equal:[eq(test.t1.a, test.t2.a)]", - "├─TableReader(Build) 10000.00 root data:TableFullScan", - "│ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - "└─MergeJoin(Probe) 12487.50 root inner join, left key:test.t2.b, right key:test.t3.b", - " ├─Projection(Build) 9990.00 root test.t3.a, test.t3.b", - " │ └─IndexLookUp 9990.00 root ", - " │ ├─IndexFullScan(Build) 9990.00 cop[tikv] table:t3, index:idx_b(b) keep order:true, stats:pseudo", - " │ └─TableRowIDScan(Probe) 9990.00 cop[tikv] table:t3 keep order:false, stats:pseudo", - " └─Projection(Probe) 9990.00 root test.t2.a, test.t2.b", - " └─IndexLookUp 9990.00 root ", - " ├─IndexFullScan(Build) 9990.00 cop[tikv] table:t2, index:idx_b(b) keep order:true, stats:pseudo", - " └─TableRowIDScan(Probe) 9990.00 cop[tikv] table:t2 keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain format = 'brief' select /*+ leading(t3), inl_join(t1) */ * from t1 join t2 on t1.a = t2.a straight_join t3 on t2.b = t3.b;", - "Plan": [ - "HashJoin 15593.77 root inner join, equal:[eq(test.t2.b, test.t3.b)]", - "├─TableReader(Build) 9990.00 root data:Selection", - "│ └─Selection 9990.00 cop[tikv] not(isnull(test.t3.b))", - "│ └─TableFullScan 10000.00 cop[tikv] table:t3 keep order:false, stats:pseudo", - "└─Projection(Probe) 12475.01 root test.t1.a, test.t1.b, test.t2.a, test.t2.b", - " └─IndexJoin 12475.01 root inner join, inner:IndexLookUp, outer key:test.t2.a, inner key:test.t1.a, equal cond:eq(test.t2.a, test.t1.a)", - " ├─TableReader(Build) 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 keep order:false, stats:pseudo", - " └─IndexLookUp(Probe) 12475.01 root ", - " ├─IndexRangeScan(Build) 12475.01 cop[tikv] table:t1, index:idx_a(a) range: decided by [eq(test.t1.a, test.t2.a)], keep order:false, stats:pseudo", - " └─TableRowIDScan(Probe) 12475.01 cop[tikv] table:t1 keep order:false, stats:pseudo" - ], - "Warn": [ - "[planner:1815]leading hint is inapplicable, check the join type or the join algorithm hint" - ] - }, - { - "SQL": "explain format = 'brief' select /*+ leading(t2), inl_join(t2) */ * from t1 join t2 on t1.a = t2.a straight_join t3 on t2.b = t3.b;", - "Plan": [ - "HashJoin 15593.77 root inner join, equal:[eq(test.t2.b, test.t3.b)]", - "├─TableReader(Build) 9990.00 root data:Selection", - "│ └─Selection 9990.00 cop[tikv] not(isnull(test.t3.b))", - "│ └─TableFullScan 10000.00 cop[tikv] table:t3 keep order:false, stats:pseudo", - "└─Projection(Probe) 12475.01 root test.t1.a, test.t1.b, test.t2.a, test.t2.b", - " └─IndexJoin 12475.01 root inner join, inner:IndexLookUp, outer key:test.t1.a, inner key:test.t2.a, equal cond:eq(test.t1.a, test.t2.a)", - " ├─TableReader(Build) 10000.00 root data:TableFullScan", - " │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - " └─IndexLookUp(Probe) 12475.01 root ", - " ├─Selection(Build) 12487.50 cop[tikv] not(isnull(test.t2.a))", - " │ └─IndexRangeScan 12500.00 cop[tikv] table:t2, index:idx_a(a) range: decided by [eq(test.t2.a, test.t1.a)], keep order:false, stats:pseudo", - " └─Selection(Probe) 12475.01 cop[tikv] not(isnull(test.t2.b))", - " └─TableRowIDScan 12487.50 cop[tikv] table:t2 keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain format = 'brief' select /*+ leading(t3), hash_join_build(t1) */ * from t1 cross join t2 on t1.a = t2.a join t3 on t2.b = t3.b;", - "Plan": [ - "Projection 15593.77 root test.t1.a, test.t1.b, test.t2.a, test.t2.b, test.t3.a, test.t3.b", - "└─HashJoin 15593.77 root inner join, equal:[eq(test.t2.a, test.t1.a)]", - " ├─TableReader(Build) 10000.00 root data:TableFullScan", - " │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - " └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t3.b, test.t2.b)]", - " ├─TableReader(Build) 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 keep order:false, stats:pseudo", - " └─TableReader(Probe) 9990.00 root data:Selection", - " └─Selection 9990.00 cop[tikv] not(isnull(test.t3.b))", - " └─TableFullScan 10000.00 cop[tikv] table:t3 keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain format = 'brief' select /*+ leading(t2), hash_join_probe(t2) */ * from t1 cross join t2 on t1.a = t2.a join t3 on t2.b = t3.b;", - "Plan": [ - "Projection 15593.77 root test.t1.a, test.t1.b, test.t2.a, test.t2.b, test.t3.a, test.t3.b", - "└─HashJoin 15593.77 root inner join, equal:[eq(test.t2.a, test.t1.a)]", - " ├─TableReader(Build) 10000.00 root data:TableFullScan", - " │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - " └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t2.b, test.t3.b)]", - " ├─TableReader(Build) 9990.00 root data:Selection", - " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t3.b))", - " │ └─TableFullScan 10000.00 cop[tikv] table:t3 keep order:false, stats:pseudo", - " └─TableReader(Probe) 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 keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain format = 'brief' select * from v", - "Plan": [ - "HashJoin 15609.38 root inner join, equal:[eq(test.t1.a, test.t.a)]", - "├─IndexReader(Build) 10000.00 root index:IndexFullScan", - "│ └─IndexFullScan 10000.00 cop[tikv] table:t, index:idx_a(a) keep order:false, stats:pseudo", - "└─IndexJoin(Probe) 12487.50 root inner join, inner:IndexLookUp, outer key:test.t2.b, inner key:test.t1.b, equal cond:eq(test.t2.b, test.t1.b)", - " ├─IndexReader(Build) 9990.00 root index:IndexFullScan", - " │ └─IndexFullScan 9990.00 cop[tikv] table:t2, index:idx_b(b) keep order:false, stats:pseudo", - " └─IndexLookUp(Probe) 12487.50 root ", - " ├─Selection(Build) 12487.50 cop[tikv] not(isnull(test.t1.b))", - " │ └─IndexRangeScan 12500.00 cop[tikv] table:t1, index:idx_b(b) range: decided by [eq(test.t1.b, test.t2.b)], keep order:false, stats:pseudo", - " └─TableRowIDScan(Probe) 12487.50 cop[tikv] table:t1 keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain format = 'brief' select * from v1", - "Plan": [ - "MergeJoin 15609.38 root inner join, left key:test.t1.a, right key:test.t.a", - "├─IndexReader(Build) 10000.00 root index:IndexFullScan", - "│ └─IndexFullScan 10000.00 cop[tikv] table:t, index:idx_a(a) keep order:true, stats:pseudo", - "└─Sort(Probe) 12487.50 root test.t1.a", - " └─HashJoin 12487.50 root inner join, equal:[eq(test.t2.b, test.t1.b)]", - " ├─IndexReader(Build) 9990.00 root index:IndexFullScan", - " │ └─IndexFullScan 9990.00 cop[tikv] table:t2, index:idx_b(b) keep order:false, stats:pseudo", - " └─TableReader(Probe) 9990.00 root data:Selection", - " └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", - " └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain format = 'brief' select /*+ qb_name(qb, v2), leading(t2@qb), merge_join(t@qb) */ * from v2", - "Plan": [ - "MergeJoin 15609.38 root inner join, left key:test.t1.a, right key:test.t.a", - "├─IndexReader(Build) 10000.00 root index:IndexFullScan", - "│ └─IndexFullScan 10000.00 cop[tikv] table:t, index:idx_a(a) keep order:true, stats:pseudo", - "└─Sort(Probe) 12487.50 root test.t1.a", - " └─HashJoin 12487.50 root inner join, equal:[eq(test.t2.b, test.t1.b)]", - " ├─IndexReader(Build) 9990.00 root index:IndexFullScan", - " │ └─IndexFullScan 9990.00 cop[tikv] table:t2, index:idx_b(b) keep order:false, stats:pseudo", - " └─TableReader(Probe) 9990.00 root data:Selection", - " └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", - " └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain format = 'brief' select /*+ qb_name(qb, v2), leading(t1@qb), inl_join(t1@qb) */ * from v2", - "Plan": [ - "HashJoin 15609.38 root inner join, equal:[eq(test.t1.a, test.t.a)]", - "├─IndexReader(Build) 10000.00 root index:IndexFullScan", - "│ └─IndexFullScan 10000.00 cop[tikv] table:t, index:idx_a(a) keep order:false, stats:pseudo", - "└─IndexJoin(Probe) 12487.50 root inner join, inner:IndexLookUp, outer key:test.t2.b, inner key:test.t1.b, equal cond:eq(test.t2.b, test.t1.b)", - " ├─IndexReader(Build) 9990.00 root index:IndexFullScan", - " │ └─IndexFullScan 9990.00 cop[tikv] table:t2, index:idx_b(b) keep order:false, stats:pseudo", - " └─IndexLookUp(Probe) 12487.50 root ", - " ├─Selection(Build) 12487.50 cop[tikv] not(isnull(test.t1.b))", - " │ └─IndexRangeScan 12500.00 cop[tikv] table:t1, index:idx_b(b) range: decided by [eq(test.t1.b, test.t2.b)], keep order:false, stats:pseudo", - " └─TableRowIDScan(Probe) 12487.50 cop[tikv] table:t1 keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain with tt as (select /*+ leading(t3), merge_join(t1) */ t1.a from t1 join t2 join t3 where t1.a = t2.a and t2.b=t3.b) select * from tt t1 join tt t2 on t1.a=t2.a", - "Plan": [ - "HashJoin_113 24316.55 root inner join, equal:[eq(test.t1.a, test.t1.a)]", - "├─Selection_117(Build) 12475.01 root not(isnull(test.t1.a))", - "│ └─CTEFullScan_118 15593.77 root CTE:tt AS t2 data:CTE_0", - "└─Selection_115(Probe) 12475.01 root not(isnull(test.t1.a))", - " └─CTEFullScan_116 15593.77 root CTE:tt AS t1 data:CTE_0", - "CTE_0 15593.77 root Non-Recursive CTE", - "└─MergeJoin_22(Seed Part) 15593.77 root inner join, left key:test.t2.a, right key:test.t1.a", - " ├─IndexReader_110(Build) 10000.00 root index:IndexFullScan_109", - " │ └─IndexFullScan_109 10000.00 cop[tikv] table:t1, index:idx_a(a) keep order:true, stats:pseudo", - " └─Sort_108(Probe) 12475.01 root test.t2.a", - " └─HashJoin_81 12475.01 root inner join, equal:[eq(test.t3.b, test.t2.b)]", - " ├─IndexReader_91(Build) 9990.00 root index:IndexFullScan_90", - " │ └─IndexFullScan_90 9990.00 cop[tikv] table:t3, index:idx_b(b) keep order:false, stats:pseudo", - " └─TableReader_96(Probe) 9980.01 root data:Selection_95", - " └─Selection_95 9980.01 cop[tikv] not(isnull(test.t2.a)), not(isnull(test.t2.b))", - " └─TableFullScan_94 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain with tt as (select /*+ leading(t2), inl_join(t2) */ t1.a from t1 join t2 join t3 where t1.a = t2.a and t2.b=t3.b) select * from tt t1 join tt t2 on t1.a=t2.a", - "Plan": [ - "HashJoin_112 24316.55 root inner join, equal:[eq(test.t1.a, test.t1.a)]", - "├─Selection_116(Build) 12475.01 root not(isnull(test.t1.a))", - "│ └─CTEFullScan_117 15593.77 root CTE:tt AS t2 data:CTE_0", - "└─Selection_114(Probe) 12475.01 root not(isnull(test.t1.a))", - " └─CTEFullScan_115 15593.77 root CTE:tt AS t1 data:CTE_0", - "CTE_0 15593.77 root Non-Recursive CTE", - "└─HashJoin_32(Seed Part) 15593.77 root inner join, equal:[eq(test.t2.a, test.t1.a)]", - " ├─IndexReader_109(Build) 10000.00 root index:IndexFullScan_108", - " │ └─IndexFullScan_108 10000.00 cop[tikv] table:t1, index:idx_a(a) keep order:false, stats:pseudo", - " └─IndexJoin_95(Probe) 12475.01 root inner join, inner:IndexLookUp_94, outer key:test.t3.b, inner key:test.t2.b, equal cond:eq(test.t3.b, test.t2.b)", - " ├─IndexReader_74(Build) 9990.00 root index:IndexFullScan_73", - " │ └─IndexFullScan_73 9990.00 cop[tikv] table:t3, index:idx_b(b) keep order:false, stats:pseudo", - " └─IndexLookUp_94(Probe) 12475.01 root ", - " ├─Selection_92(Build) 12487.50 cop[tikv] not(isnull(test.t2.b))", - " │ └─IndexRangeScan_90 12500.00 cop[tikv] table:t2, index:idx_b(b) range: decided by [eq(test.t2.b, test.t3.b)], keep order:false, stats:pseudo", - " └─Selection_93(Probe) 12475.01 cop[tikv] not(isnull(test.t2.a))", - " └─TableRowIDScan_91 12487.50 cop[tikv] table:t2 keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain with tt as (select /*+ merge(), leading(t3), inl_join(t1) */ t1.a from t1 join t2 join t3 where t1.a = t2.a and t2.b=t3.b) select * from tt t1 join tt t2 on t1.a=t2.a", - "Plan": [ - "HashJoin_48 30395.69 root inner join, equal:[eq(test.t2.b, test.t3.b)]", - "├─IndexReader_169(Build) 9990.00 root index:IndexFullScan_168", - "│ └─IndexFullScan_168 9990.00 cop[tikv] table:t3, index:idx_b(b) keep order:false, stats:pseudo", - "└─HashJoin_68(Probe) 24316.55 root inner join, equal:[eq(test.t1.a, test.t2.a)]", - " ├─TableReader_159(Build) 9980.01 root data:Selection_158", - " │ └─Selection_158 9980.01 cop[tikv] not(isnull(test.t2.a)), not(isnull(test.t2.b))", - " │ └─TableFullScan_157 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo", - " └─IndexJoin_150(Probe) 19492.21 root inner join, inner:IndexReader_149, outer key:test.t1.a, inner key:test.t1.a, equal cond:eq(test.t1.a, test.t1.a)", - " ├─IndexJoin_84(Build) 15593.77 root inner join, inner:IndexReader_83, outer key:test.t2.a, inner key:test.t1.a, equal cond:eq(test.t2.a, test.t1.a)", - " │ ├─HashJoin_119(Build) 12475.01 root inner join, equal:[eq(test.t2.b, test.t3.b)]", - " │ │ ├─IndexReader_140(Build) 9990.00 root index:IndexFullScan_139", - " │ │ │ └─IndexFullScan_139 9990.00 cop[tikv] table:t3, index:idx_b(b) keep order:false, stats:pseudo", - " │ │ └─TableReader_130(Probe) 9980.01 root data:Selection_129", - " │ │ └─Selection_129 9980.01 cop[tikv] not(isnull(test.t2.a)), not(isnull(test.t2.b))", - " │ │ └─TableFullScan_128 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo", - " │ └─IndexReader_83(Probe) 15593.77 root index:IndexRangeScan_82", - " │ └─IndexRangeScan_82 15593.77 cop[tikv] table:t1, index:idx_a(a) range: decided by [eq(test.t1.a, test.t2.a)], keep order:false, stats:pseudo", - " └─IndexReader_149(Probe) 19492.21 root index:IndexRangeScan_148", - " └─IndexRangeScan_148 19492.21 cop[tikv] table:t1, index:idx_a(a) range: decided by [eq(test.t1.a, test.t1.a)], keep order:false, stats:pseudo" - ], - "Warn": [ - "[planner:1815]We can only use one leading hint at most, when multiple leading hints are used, all leading hints will be invalid", - "[planner:1815]There are no matching table names for (t1) in optimizer hint /*+ INL_JOIN(t1, t1) */ or /*+ TIDB_INLJ(t1, t1) */. Maybe you can use the table alias name", - "[planner:1815]We can only use one leading hint at most, when multiple leading hints are used, all leading hints will be invalid", - "[planner:1815]There are no matching table names for (t1, t1) in optimizer hint /*+ INL_JOIN(t1, t1, t1) */ or /*+ TIDB_INLJ(t1, t1, t1) */. Maybe you can use the table alias name" - ] - }, - { - "SQL": "explain with tt as (select /*+ leading(t2), merge_join(t2), merge() */ t1.a from t1 join t2 join t3 where t1.a = t2.a and t2.b=t3.b) select * from tt t1 join tt t2 on t1.a=t2.a", - "Plan": [ - "HashJoin_48 30395.69 root inner join, equal:[eq(test.t2.b, test.t3.b)]", - "├─IndexReader_145(Build) 9990.00 root index:IndexFullScan_144", - "│ └─IndexFullScan_144 9990.00 cop[tikv] table:t3, index:idx_b(b) keep order:false, stats:pseudo", - "└─MergeJoin_142(Probe) 24316.55 root inner join, left key:test.t1.a, right key:test.t2.a", - " ├─Projection_92(Build) 9980.01 root test.t2.a, test.t2.b", - " │ └─IndexLookUp_91 9980.01 root ", - " │ ├─IndexFullScan_88(Build) 9990.00 cop[tikv] table:t2, index:idx_a(a) keep order:true, stats:pseudo", - " │ └─Selection_90(Probe) 9980.01 cop[tikv] not(isnull(test.t2.b))", - " │ └─TableRowIDScan_89 9990.00 cop[tikv] table:t2 keep order:false, stats:pseudo", - " └─MergeJoin_53(Probe) 19492.21 root inner join, left key:test.t1.a, right key:test.t1.a", - " ├─IndexReader_87(Build) 10000.00 root index:IndexFullScan_86", - " │ └─IndexFullScan_86 10000.00 cop[tikv] table:t1, index:idx_a(a) keep order:true, stats:pseudo", - " └─MergeJoin_54(Probe) 15593.77 root inner join, left key:test.t2.a, right key:test.t1.a", - " ├─IndexReader_85(Build) 10000.00 root index:IndexFullScan_84", - " │ └─IndexFullScan_84 10000.00 cop[tikv] table:t1, index:idx_a(a) keep order:true, stats:pseudo", - " └─Sort_75(Probe) 12475.01 root test.t2.a", - " └─MergeJoin_66 12475.01 root inner join, left key:test.t2.b, right key:test.t3.b", - " ├─IndexReader_74(Build) 9990.00 root index:IndexFullScan_73", - " │ └─IndexFullScan_73 9990.00 cop[tikv] table:t3, index:idx_b(b) keep order:true, stats:pseudo", - " └─Projection_72(Probe) 9980.01 root test.t2.a, test.t2.b", - " └─IndexLookUp_71 9980.01 root ", - " ├─IndexFullScan_68(Build) 9990.00 cop[tikv] table:t2, index:idx_b(b) keep order:true, stats:pseudo", - " └─Selection_70(Probe) 9980.01 cop[tikv] not(isnull(test.t2.a))", - " └─TableRowIDScan_69 9990.00 cop[tikv] table:t2 keep order:false, stats:pseudo" - ], - "Warn": [ - "[planner:1815]We can only use one leading hint at most, when multiple leading hints are used, all leading hints will be invalid", - "[planner:1815]There are no matching table names for (t2) in optimizer hint /*+ MERGE_JOIN(t2, t2) */ or /*+ TIDB_SMJ(t2, t2) */. Maybe you can use the table alias name", - "[planner:1815]We can only use one leading hint at most, when multiple leading hints are used, all leading hints will be invalid", - "[planner:1815]There are no matching table names for (t2, t2) in optimizer hint /*+ MERGE_JOIN(t2, t2, t2) */ or /*+ TIDB_SMJ(t2, t2, t2) */. Maybe you can use the table alias name" - ] - }, - { - "SQL": "explain format = 'brief' SELECT /*+ leading(t2@sel_2), merge_join(t) */ * FROM t join t1 on t.a = t1.a WHERE EXISTS (SELECT 1 FROM t2 WHERE t2.b = t1.b);", - "Plan": [ - "HashJoin 9990.00 root semi join, equal:[eq(test.t1.b, test.t2.b)]", - "├─IndexReader(Build) 9990.00 root index:IndexFullScan", - "│ └─IndexFullScan 9990.00 cop[tikv] table:t2, index:idx_b(b) keep order:false, stats:pseudo", - "└─Projection(Probe) 12487.50 root test.t.a, test.t.b, test.t1.a, test.t1.b", - " └─MergeJoin 12487.50 root inner join, left key:test.t1.a, right key:test.t.a", - " ├─Projection(Build) 10000.00 root test.t.a, test.t.b", - " │ └─IndexLookUp 10000.00 root ", - " │ ├─IndexFullScan(Build) 10000.00 cop[tikv] table:t, index:idx_a(a) keep order:true, stats:pseudo", - " │ └─TableRowIDScan(Probe) 10000.00 cop[tikv] table:t keep order:false, stats:pseudo", - " └─Projection(Probe) 9990.00 root test.t1.a, test.t1.b", - " └─IndexLookUp 9990.00 root ", - " ├─IndexFullScan(Build) 10000.00 cop[tikv] table:t1, index:idx_a(a) keep order:true, stats:pseudo", - " └─Selection(Probe) 9990.00 cop[tikv] not(isnull(test.t1.b))", - " └─TableRowIDScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo" - ], - "Warn": [ - "[planner:1815]leading hint is inapplicable, check the join type or the join algorithm hint" - ] - }, - { - "SQL": "explain format = 'brief' SELECT /*+ leading(t1), inl_join(t1) */ * FROM t join t1 on t.a = t1.a WHERE EXISTS (SELECT 1 FROM t2 WHERE t2.b = t1.b);", - "Plan": [ - "HashJoin 9990.00 root semi join, equal:[eq(test.t1.b, test.t2.b)]", - "├─IndexReader(Build) 9990.00 root index:IndexFullScan", - "│ └─IndexFullScan 9990.00 cop[tikv] table:t2, index:idx_b(b) keep order:false, stats:pseudo", - "└─Projection(Probe) 12487.50 root test.t.a, test.t.b, test.t1.a, test.t1.b", - " └─IndexJoin 12487.50 root inner join, inner:IndexLookUp, outer key:test.t.a, inner key:test.t1.a, equal cond:eq(test.t.a, test.t1.a)", - " ├─TableReader(Build) 10000.00 root data:TableFullScan", - " │ └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo", - " └─IndexLookUp(Probe) 12487.50 root ", - " ├─IndexRangeScan(Build) 12500.00 cop[tikv] table:t1, index:idx_a(a) range: decided by [eq(test.t1.a, test.t.a)], keep order:false, stats:pseudo", - " └─Selection(Probe) 12487.50 cop[tikv] not(isnull(test.t1.b))", - " └─TableRowIDScan 12500.00 cop[tikv] table:t1 keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain format = 'brief' SELECT /*+ leading(t2@sel_2), merge_join(t) */ * FROM t join t1 on t.a = t1.a WHERE EXISTS (SELECT /*+ SEMI_JOIN_REWRITE() */ 1 FROM t2 WHERE t2.b = t1.b);", - "Plan": [ - "Projection 12487.50 root test.t.a, test.t.b, test.t1.a, test.t1.b", - "└─MergeJoin 12487.50 root inner join, left key:test.t1.a, right key:test.t.a", - " ├─Projection(Build) 10000.00 root test.t.a, test.t.b", - " │ └─IndexLookUp 10000.00 root ", - " │ ├─IndexFullScan(Build) 10000.00 cop[tikv] table:t, index:idx_a(a) keep order:true, stats:pseudo", - " │ └─TableRowIDScan(Probe) 10000.00 cop[tikv] table:t keep order:false, stats:pseudo", - " └─Sort(Probe) 9990.00 root test.t1.a", - " └─HashJoin 9990.00 root inner join, equal:[eq(test.t2.b, test.t1.b)]", - " ├─StreamAgg(Build) 7992.00 root group by:test.t2.b, funcs:firstrow(test.t2.b)->test.t2.b", - " │ └─IndexReader 7992.00 root index:StreamAgg", - " │ └─StreamAgg 7992.00 cop[tikv] group by:test.t2.b, ", - " │ └─IndexFullScan 9990.00 cop[tikv] table:t2, index:idx_b(b) keep order:true, stats:pseudo", - " └─TableReader(Probe) 9990.00 root data:Selection", - " └─Selection 9990.00 cop[tikv] not(isnull(test.t1.b))", - " └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain format = 'brief' SELECT /*+ leading(t1), inl_join(t1) */ * FROM t join t1 on t.a = t1.a WHERE EXISTS (SELECT /*+ SEMI_JOIN_REWRITE() */ 1 FROM t2 WHERE t2.b = t1.b);", - "Plan": [ - "Projection 12487.50 root test.t.a, test.t.b, test.t1.a, test.t1.b", - "└─HashJoin 12487.50 root inner join, equal:[eq(test.t1.b, test.t2.b)]", - " ├─StreamAgg(Build) 7992.00 root group by:test.t2.b, funcs:firstrow(test.t2.b)->test.t2.b", - " │ └─IndexReader 7992.00 root index:StreamAgg", - " │ └─StreamAgg 7992.00 cop[tikv] group by:test.t2.b, ", - " │ └─IndexFullScan 9990.00 cop[tikv] table:t2, index:idx_b(b) keep order:true, stats:pseudo", - " └─IndexJoin(Probe) 12487.50 root inner join, inner:IndexLookUp, outer key:test.t.a, inner key:test.t1.a, equal cond:eq(test.t.a, test.t1.a)", - " ├─TableReader(Build) 10000.00 root data:TableFullScan", - " │ └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo", - " └─IndexLookUp(Probe) 12487.50 root ", - " ├─IndexRangeScan(Build) 12500.00 cop[tikv] table:t1, index:idx_a(a) range: decided by [eq(test.t1.a, test.t.a)], keep order:false, stats:pseudo", - " └─Selection(Probe) 12487.50 cop[tikv] not(isnull(test.t1.b))", - " └─TableRowIDScan 12500.00 cop[tikv] table:t1 keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain format = 'brief' select /*+ leading(t2@sel_2) merge_join(t) */ * from t join t1 on t.a = t1.a where t1.a < (select sum(t2.a) from t2 where t2.b = t1.b);", - "Plan": [ - "Projection 12487.50 root test.t.a, test.t.b, test.t1.a, test.t1.b", - "└─HashJoin 12487.50 root inner join, equal:[eq(test.t1.b, test.t2.b)], other cond:lt(cast(test.t1.a, decimal(10,0) BINARY), Column#10)", - " ├─HashAgg(Build) 7992.00 root group by:test.t2.b, funcs:sum(Column#24)->Column#10, funcs:firstrow(test.t2.b)->test.t2.b", - " │ └─TableReader 7992.00 root data:HashAgg", - " │ └─HashAgg 7992.00 cop[tikv] group by:test.t2.b, funcs:sum(test.t2.a)->Column#24", - " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", - " │ └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo", - " └─MergeJoin(Probe) 12487.50 root inner join, left key:test.t1.a, right key:test.t.a", - " ├─Projection(Build) 10000.00 root test.t.a, test.t.b", - " │ └─IndexLookUp 10000.00 root ", - " │ ├─IndexFullScan(Build) 10000.00 cop[tikv] table:t, index:idx_a(a) keep order:true, stats:pseudo", - " │ └─TableRowIDScan(Probe) 10000.00 cop[tikv] table:t keep order:false, stats:pseudo", - " └─Projection(Probe) 9990.00 root test.t1.a, test.t1.b", - " └─IndexLookUp 9990.00 root ", - " ├─IndexFullScan(Build) 10000.00 cop[tikv] table:t1, index:idx_a(a) keep order:true, stats:pseudo", - " └─Selection(Probe) 9990.00 cop[tikv] not(isnull(test.t1.b))", - " └─TableRowIDScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo" - ], - "Warn": [ - "[planner:1815]There are no matching table names for (t2) in optimizer hint /*+ LEADING(t2) */. Maybe you can use the table alias name" - ] - }, - { - "SQL": "explain format = 'brief' select /*+ leading(t1), inl_join(t1) */ * from t join t1 on t.a = t1.a where t1.a < (select sum(t2.a) from t2 where t2.b = t1.b);", - "Plan": [ - "Projection 12487.50 root test.t.a, test.t.b, test.t1.a, test.t1.b", - "└─HashJoin 12487.50 root inner join, equal:[eq(test.t1.b, test.t2.b)], other cond:lt(cast(test.t1.a, decimal(10,0) BINARY), Column#10)", - " ├─HashAgg(Build) 7992.00 root group by:test.t2.b, funcs:sum(Column#28)->Column#10, funcs:firstrow(test.t2.b)->test.t2.b", - " │ └─TableReader 7992.00 root data:HashAgg", - " │ └─HashAgg 7992.00 cop[tikv] group by:test.t2.b, funcs:sum(test.t2.a)->Column#28", - " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", - " │ └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo", - " └─IndexJoin(Probe) 12487.50 root inner join, inner:IndexLookUp, outer key:test.t.a, inner key:test.t1.a, equal cond:eq(test.t.a, test.t1.a)", - " ├─TableReader(Build) 10000.00 root data:TableFullScan", - " │ └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo", - " └─IndexLookUp(Probe) 12487.50 root ", - " ├─IndexRangeScan(Build) 12500.00 cop[tikv] table:t1, index:idx_a(a) range: decided by [eq(test.t1.a, test.t.a)], keep order:false, stats:pseudo", - " └─Selection(Probe) 12487.50 cop[tikv] not(isnull(test.t1.b))", - " └─TableRowIDScan 12500.00 cop[tikv] table:t1 keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain format = 'brief' select /*+leading(t2@sel_2) merge_join(t) */ * from t join t1 on t.a = t1.a where t1.a < (select /*+ NO_DECORRELATE() */ sum(t2.a) from t2 where t2.b = t1.b);", - "Plan": [ - "Projection 12500.00 root test.t.a, test.t.b, test.t1.a, test.t1.b", - "└─Apply 12500.00 root CARTESIAN inner join, other cond:lt(cast(test.t1.a, decimal(10,0) BINARY), Column#10)", - " ├─MergeJoin(Build) 12500.00 root inner join, left key:test.t.a, right key:test.t1.a", - " │ ├─Projection(Build) 10000.00 root test.t1.a, test.t1.b", - " │ │ └─IndexLookUp 10000.00 root ", - " │ │ ├─IndexFullScan(Build) 10000.00 cop[tikv] table:t1, index:idx_a(a) keep order:true, stats:pseudo", - " │ │ └─TableRowIDScan(Probe) 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - " │ └─Projection(Probe) 10000.00 root test.t.a, test.t.b", - " │ └─IndexLookUp 10000.00 root ", - " │ ├─IndexFullScan(Build) 10000.00 cop[tikv] table:t, index:idx_a(a) keep order:true, stats:pseudo", - " │ └─TableRowIDScan(Probe) 10000.00 cop[tikv] table:t keep order:false, stats:pseudo", - " └─MaxOneRow(Probe) 12500.00 root ", - " └─StreamAgg 12500.00 root funcs:sum(Column#25)->Column#10", - " └─Projection 125000.00 root cast(test.t2.a, decimal(10,0) BINARY)->Column#25", - " └─IndexLookUp 125000.00 root ", - " ├─IndexRangeScan(Build) 125000.00 cop[tikv] table:t2, index:idx_b(b) range: decided by [eq(test.t2.b, test.t1.b)], keep order:false, stats:pseudo", - " └─TableRowIDScan(Probe) 125000.00 cop[tikv] table:t2 keep order:false, stats:pseudo" - ], - "Warn": [ - "[planner:1815]There are no matching table names for (t2) in optimizer hint /*+ LEADING(t2) */. Maybe you can use the table alias name" - ] - }, - { - "SQL": "explain format = 'brief' select /*+ leading(t1), inl_join(t1) */ * from t join t1 on t.a = t1.a where t1.a < (select /*+ NO_DECORRELATE() */ sum(t2.a) from t2 where t2.b = t1.b);", - "Plan": [ - "Projection 12500.00 root test.t.a, test.t.b, test.t1.a, test.t1.b", - "└─Apply 12500.00 root CARTESIAN inner join, other cond:lt(cast(test.t1.a, decimal(10,0) BINARY), Column#10)", - " ├─Projection(Build) 12500.00 root test.t.a, test.t.b, test.t1.a, test.t1.b", - " │ └─IndexJoin 12500.00 root inner join, inner:IndexLookUp, outer key:test.t.a, inner key:test.t1.a, equal cond:eq(test.t.a, test.t1.a)", - " │ ├─TableReader(Build) 10000.00 root data:TableFullScan", - " │ │ └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo", - " │ └─IndexLookUp(Probe) 12500.00 root ", - " │ ├─IndexRangeScan(Build) 12500.00 cop[tikv] table:t1, index:idx_a(a) range: decided by [eq(test.t1.a, test.t.a)], keep order:false, stats:pseudo", - " │ └─TableRowIDScan(Probe) 12500.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - " └─MaxOneRow(Probe) 12500.00 root ", - " └─StreamAgg 12500.00 root funcs:sum(Column#23)->Column#10", - " └─Projection 125000.00 root cast(test.t2.a, decimal(10,0) BINARY)->Column#23", - " └─IndexLookUp 125000.00 root ", - " ├─IndexRangeScan(Build) 125000.00 cop[tikv] table:t2, index:idx_b(b) range: decided by [eq(test.t2.b, test.t1.b)], keep order:false, stats:pseudo", - " └─TableRowIDScan(Probe) 125000.00 cop[tikv] table:t2 keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain format = 'brief' select /*+ leading(t9), hash_join(t7) */ * from t7 join t8 join t9 where t7.a = t8.a and t8.b = t9.b;", - "Plan": [ - "Projection 15593.77 root test.t7.a, test.t7.b, test.t8.a, test.t8.b, test.t9.a, test.t9.b", - "└─HashJoin 15593.77 root inner join, equal:[eq(test.t8.a, test.t7.a)]", - " ├─TableReader(Build) 9990.00 root partition:all data:Selection", - " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t7.a))", - " │ └─TableFullScan 10000.00 cop[tikv] table:t7 keep order:false, stats:pseudo", - " └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t9.b, test.t8.b)]", - " ├─TableReader(Build) 9980.01 root partition:all data:Selection", - " │ └─Selection 9980.01 cop[tikv] not(isnull(test.t8.a)), not(isnull(test.t8.b))", - " │ └─TableFullScan 10000.00 cop[tikv] table:t8 keep order:false, stats:pseudo", - " └─TableReader(Probe) 9990.00 root partition:all data:Selection", - " └─Selection 9990.00 cop[tikv] not(isnull(test.t9.b))", - " └─TableFullScan 10000.00 cop[tikv] table:t9 keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain format = 'brief' select /*+ leading(t8), hash_join(t8) */ * from t7 join t8 join t9 where t7.a = t8.a and t8.b = t9.b;", - "Plan": [ - "Projection 15593.77 root test.t7.a, test.t7.b, test.t8.a, test.t8.b, test.t9.a, test.t9.b", - "└─HashJoin 15593.77 root inner join, equal:[eq(test.t8.b, test.t9.b)]", - " ├─TableReader(Build) 9990.00 root partition:all data:Selection", - " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t9.b))", - " │ └─TableFullScan 10000.00 cop[tikv] table:t9 keep order:false, stats:pseudo", - " └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t8.a, test.t7.a)]", - " ├─TableReader(Build) 9980.01 root partition:all data:Selection", - " │ └─Selection 9980.01 cop[tikv] not(isnull(test.t8.a)), not(isnull(test.t8.b))", - " │ └─TableFullScan 10000.00 cop[tikv] table:t8 keep order:false, stats:pseudo", - " └─TableReader(Probe) 9990.00 root partition:all data:Selection", - " └─Selection 9990.00 cop[tikv] not(isnull(test.t7.a))", - " └─TableFullScan 10000.00 cop[tikv] table:t7 keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain format = 'brief' select /*+ read_from_storage(tikv[t4, t6]), leading(t6), hash_join_build(t4) */ * from t4 join t5 join t6 where t4.a = t5.a and t5.b = t6.b;", - "Plan": [ - "Projection 15593.77 root test.t4.a, test.t4.b, test.t5.a, test.t5.b, test.t6.a, test.t6.b", - "└─HashJoin 15593.77 root inner join, equal:[eq(test.t5.a, test.t4.a)]", - " ├─TableReader(Build) 9990.00 root data:Selection", - " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t4.a))", - " │ └─TableFullScan 10000.00 cop[tikv] table:t4 keep order:false, stats:pseudo", - " └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t6.b, test.t5.b)]", - " ├─TableReader(Build) 9980.01 root MppVersion: 2, data:ExchangeSender", - " │ └─ExchangeSender 9980.01 mpp[tiflash] ExchangeType: PassThrough", - " │ └─Selection 9980.01 mpp[tiflash] not(isnull(test.t5.a)), not(isnull(test.t5.b))", - " │ └─TableFullScan 10000.00 mpp[tiflash] table:t5 pushed down filter:empty, keep order:false, stats:pseudo", - " └─TableReader(Probe) 9990.00 root data:Selection", - " └─Selection 9990.00 cop[tikv] not(isnull(test.t6.b))", - " └─TableFullScan 10000.00 cop[tikv] table:t6 keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain format = 'brief' select /*+ read_from_storage(tikv[t5]), leading(t5), hash_join_probe(t5) */ * from t4 join t5 join t6 where t4.a = t5.a and t5.b = t6.b;", - "Plan": [ - "Projection 15593.77 root test.t4.a, test.t4.b, test.t5.a, test.t5.b, test.t6.a, test.t6.b", - "└─HashJoin 15593.77 root inner join, equal:[eq(test.t5.b, test.t6.b)]", - " ├─TableReader(Build) 9990.00 root MppVersion: 2, data:ExchangeSender", - " │ └─ExchangeSender 9990.00 mpp[tiflash] ExchangeType: PassThrough", - " │ └─Selection 9990.00 mpp[tiflash] not(isnull(test.t6.b))", - " │ └─TableFullScan 10000.00 mpp[tiflash] table:t6 pushed down filter:empty, keep order:false, stats:pseudo", - " └─HashJoin(Probe) 12475.01 root inner join, equal:[eq(test.t5.a, test.t4.a)]", - " ├─TableReader(Build) 9990.00 root MppVersion: 2, data:ExchangeSender", - " │ └─ExchangeSender 9990.00 mpp[tiflash] ExchangeType: PassThrough", - " │ └─Selection 9990.00 mpp[tiflash] not(isnull(test.t4.a))", - " │ └─TableFullScan 10000.00 mpp[tiflash] table:t4 pushed down filter:empty, keep order:false, stats:pseudo", - " └─TableReader(Probe) 9980.01 root data:Selection", - " └─Selection 9980.01 cop[tikv] not(isnull(test.t5.a)), not(isnull(test.t5.b))", - " └─TableFullScan 10000.00 cop[tikv] table:t5 keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain format = 'brief' select /*+ read_from_storage(tiflash[t4, t6]), leading(t6), hash_join_build(t4) */ * from t4 join t5 join t6 where t4.a = t5.a and t5.b = t6.b;", - "Plan": [ - "TableReader 15593.77 root MppVersion: 2, data:ExchangeSender", - "└─ExchangeSender 15593.77 mpp[tiflash] ExchangeType: PassThrough", - " └─Projection 15593.77 mpp[tiflash] test.t4.a, test.t4.b, test.t5.a, test.t5.b, test.t6.a, test.t6.b", - " └─HashJoin 15593.77 mpp[tiflash] inner join, equal:[eq(test.t5.a, test.t4.a)]", - " ├─ExchangeReceiver(Build) 9990.00 mpp[tiflash] ", - " │ └─ExchangeSender 9990.00 mpp[tiflash] ExchangeType: Broadcast, Compression: FAST", - " │ └─Selection 9990.00 mpp[tiflash] not(isnull(test.t4.a))", - " │ └─TableFullScan 10000.00 mpp[tiflash] table:t4 pushed down filter:empty, keep order:false, stats:pseudo", - " └─HashJoin(Probe) 12475.01 mpp[tiflash] inner join, equal:[eq(test.t6.b, test.t5.b)]", - " ├─ExchangeReceiver(Build) 9980.01 mpp[tiflash] ", - " │ └─ExchangeSender 9980.01 mpp[tiflash] ExchangeType: Broadcast, Compression: FAST", - " │ └─Selection 9980.01 mpp[tiflash] not(isnull(test.t5.a)), not(isnull(test.t5.b))", - " │ └─TableFullScan 10000.00 mpp[tiflash] table:t5 pushed down filter:empty, keep order:false, stats:pseudo", - " └─Selection(Probe) 9990.00 mpp[tiflash] not(isnull(test.t6.b))", - " └─TableFullScan 10000.00 mpp[tiflash] table:t6 pushed down filter:empty, keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain format = 'brief' select /*+ read_from_storage(tiflash[t5]), leading(t5), hash_join_probe(t5) */ * from t4 join t5 join t6 where t4.a = t5.a and t5.b = t6.b;", - "Plan": [ - "TableReader 15593.77 root MppVersion: 2, data:ExchangeSender", - "└─ExchangeSender 15593.77 mpp[tiflash] ExchangeType: PassThrough", - " └─Projection 15593.77 mpp[tiflash] test.t4.a, test.t4.b, test.t5.a, test.t5.b, test.t6.a, test.t6.b", - " └─HashJoin 15593.77 mpp[tiflash] inner join, equal:[eq(test.t5.b, test.t6.b)]", - " ├─ExchangeReceiver(Build) 9990.00 mpp[tiflash] ", - " │ └─ExchangeSender 9990.00 mpp[tiflash] ExchangeType: Broadcast, Compression: FAST", - " │ └─Selection 9990.00 mpp[tiflash] not(isnull(test.t6.b))", - " │ └─TableFullScan 10000.00 mpp[tiflash] table:t6 pushed down filter:empty, keep order:false, stats:pseudo", - " └─HashJoin(Probe) 12475.01 mpp[tiflash] inner join, equal:[eq(test.t5.a, test.t4.a)]", - " ├─ExchangeReceiver(Build) 9990.00 mpp[tiflash] ", - " │ └─ExchangeSender 9990.00 mpp[tiflash] ExchangeType: Broadcast, Compression: FAST", - " │ └─Selection 9990.00 mpp[tiflash] not(isnull(test.t4.a))", - " │ └─TableFullScan 10000.00 mpp[tiflash] table:t4 pushed down filter:empty, keep order:false, stats:pseudo", - " └─Selection(Probe) 9980.01 mpp[tiflash] not(isnull(test.t5.a)), not(isnull(test.t5.b))", - " └─TableFullScan 10000.00 mpp[tiflash] table:t5 pushed down filter:empty, keep order:false, stats:pseudo" - ], - "Warn": null - } - ] - }, - { - "Name": "TestReadFromStorageHintAndIsolationRead", - "Cases": [ - { - "SQL": "desc format = 'brief' select /*+ read_from_storage(tikv[t], tiflash[t]) */ 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" - ], - "Warn": [ - "[planner:1815]Storage hints are conflict, you can only specify one storage type of table test.t" - ] - }, - { - "SQL": "desc format = 'brief' select /*+ read_from_storage(tikv[t]) */ 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" - ], - "Warn": null - }, - { - "SQL": "desc format = 'brief' select /*+ read_from_storage(tiflash[t]) */ 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" - ], - "Warn": [ - "[planner:1815]No available path for table test.t with the store type tiflash of the hint /*+ read_from_storage */, please check the status of the table replica and variable value of tidb_isolation_read_engines(map[0:{}])" - ] - } - ] - }, - { - "Name": "TestIsolationReadDoNotFilterSystemDB", - "Cases": [ - { - "SQL": "desc format = 'brief' select * from metrics_schema.tidb_query_duration where time >= '2019-12-23 16:10:13' and time <= '2019-12-23 16:30:13'", - "Plan": [ - "MemTableScan 10000.00 root table:tidb_query_duration PromQL:histogram_quantile(0.9, sum(rate(tidb_server_handle_query_duration_seconds_bucket{}[60s])) by (le,sql_type,instance)), start_time:2019-12-23 16:10:13, end_time:2019-12-23 16:30:13, step:1m0s" - ] - }, - { - "SQL": "desc format = 'brief' select * from information_schema.tables", - "Plan": [ - "MemTableScan 10000.00 root table:TABLES " - ] - }, - { - "SQL": "desc format = 'brief' select * from mysql.stats_meta", - "Plan": [ - "TableReader 10000.00 root data:TableFullScan", - "└─TableFullScan 10000.00 cop[tikv] table:stats_meta keep order:false, stats:pseudo" - ] - } - ] - }, - { - "Name": "TestIsolationReadTiFlashNotChoosePointGet", - "Cases": [ - { - "SQL": "explain format = 'brief' select * from t where t.a = 1", - "Result": [ - "TableReader 1.00 root MppVersion: 2, data:ExchangeSender", - "└─ExchangeSender 1.00 mpp[tiflash] ExchangeType: PassThrough", - " └─TableRangeScan 1.00 mpp[tiflash] table:t range:[1,1], keep order:false, stats:pseudo" - ] + "TableReader 10000.00 root data:TableFullScan", + "└─TableFullScan 10000.00 cop[tikv] table:stats_meta keep order:false, stats:pseudo" + ] + } + ] + }, + { + "Name": "TestIsolationReadTiFlashNotChoosePointGet", + "Cases": [ + { + "SQL": "explain format = 'brief' select * from t where t.a = 1", + "Result": [ + "TableReader 1.00 root MppVersion: 2, data:ExchangeSender", + "└─ExchangeSender 1.00 mpp[tiflash] ExchangeType: PassThrough", + " └─TableRangeScan 1.00 mpp[tiflash] table:t range:[1,1], keep order:false, stats:pseudo" + ] }, { "SQL": "explain format = 'brief' select * from t where t.a in (1, 2)", @@ -6572,49 +2626,6 @@ } ] }, - { - "Name": "TestIsolationReadTiFlashUseIndexHint", - "Cases": [ - { - "SQL": "explain format = 'brief' select * from t", - "Plan": [ - "TableReader 10000.00 root MppVersion: 2, data:ExchangeSender", - "└─ExchangeSender 10000.00 mpp[tiflash] ExchangeType: PassThrough", - " └─TableFullScan 10000.00 mpp[tiflash] table:t keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain format = 'brief' select * from t use index();", - "Plan": [ - "TableReader 10000.00 root MppVersion: 2, data:ExchangeSender", - "└─ExchangeSender 10000.00 mpp[tiflash] ExchangeType: PassThrough", - " └─TableFullScan 10000.00 mpp[tiflash] table:t keep order:false, stats:pseudo" - ], - "Warn": null - }, - { - "SQL": "explain format = 'brief' select /*+ use_index(t, idx)*/ * from t", - "Plan": [ - "TableReader 10000.00 root MppVersion: 2, data:ExchangeSender", - "└─ExchangeSender 10000.00 mpp[tiflash] ExchangeType: PassThrough", - " └─TableFullScan 10000.00 mpp[tiflash] table:t keep order:false, stats:pseudo" - ], - "Warn": [ - "TiDB doesn't support index in the isolation read engines(value: 'tiflash')" - ] - }, - { - "SQL": "explain format = 'brief' select /*+ use_index(t)*/ * from t", - "Plan": [ - "TableReader 10000.00 root MppVersion: 2, data:ExchangeSender", - "└─ExchangeSender 10000.00 mpp[tiflash] ExchangeType: PassThrough", - " └─TableFullScan 10000.00 mpp[tiflash] table:t keep order:false, stats:pseudo" - ], - "Warn": null - } - ] - }, { "Name": "TestIssue20710", "Cases": [