Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

planner: update some UTs from cost model1 to model2 #39124

Merged
merged 8 commits into from
Nov 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion executor/executor_issue_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ func TestIssue24210(t *testing.T) {
store := testkit.CreateMockStore(t)
tk := testkit.NewTestKit(t, store)
tk.MustExec("use test")
tk.MustExec("set tidb_cost_model_version=1")

// for ProjectionExec
require.NoError(t, failpoint.Enable("github.com/pingcap/tidb/executor/mockProjectionExecBaseExecutorOpenReturnedError", `return(true)`))
Expand Down Expand Up @@ -579,6 +580,7 @@ func TestIssue30382(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("set @@session.tidb_enable_list_partition = ON;")
tk.MustExec("drop table if exists t1, t2;")
tk.MustExec("create table t1 (c_int int, c_str varchar(40), c_decimal decimal(12, 6), primary key (c_int) , key(c_str(2)) , key(c_decimal) ) partition by list (c_int) ( partition p0 values IN (1, 5, 9, 13, 17, 21, 25, 29, 33, 37), partition p1 values IN (2, 6, 10, 14, 18, 22, 26, 30, 34, 38), partition p2 values IN (3, 7, 11, 15, 19, 23, 27, 31, 35, 39), partition p3 values IN (4, 8, 12, 16, 20, 24, 28, 32, 36, 40)) ;")
Expand All @@ -596,7 +598,7 @@ func TestIssue30382(t *testing.T) {
"SelectLock 6400.00 root for update 0",
"└─HashJoin 6400.00 root CARTESIAN inner join, other cond:or(gt(Column#8, 1), or(ne(test.t1.c_str, Column#7), if(ne(Column#9, 0), NULL, 0)))",
" ├─Selection(Build) 0.80 root ne(Column#10, 0)",
" │ └─StreamAgg 1.00 root funcs:max(Column#17)->Column#7, funcs:count(distinct Column#18)->Column#8, funcs:sum(Column#19)->Column#9, funcs:count(1)->Column#10",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected, model2 prefers to use HashAgg.

" │ └─HashAgg 1.00 root funcs:max(Column#17)->Column#7, funcs:count(distinct Column#18)->Column#8, funcs:sum(Column#19)->Column#9, funcs:count(1)->Column#10",
" │ └─Projection 3323.33 root test.t2.c_str, test.t2.c_str, cast(isnull(test.t2.c_str), decimal(20,0) BINARY)->Column#19",
" │ └─TableReader 3323.33 root partition:all data:Selection",
" │ └─Selection 3323.33 cop[tikv] lt(test.t2.c_decimal, 5)",
Expand Down
3 changes: 2 additions & 1 deletion executor/join_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1412,6 +1412,7 @@ func TestIndexNestedLoopHashJoin(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("set @@tidb_init_chunk_size=2")
tk.MustExec("set @@tidb_index_join_batch_size=10")
tk.MustExec("DROP TABLE IF EXISTS t, s")
Expand Down Expand Up @@ -1478,7 +1479,7 @@ func TestIndexNestedLoopHashJoin(t *testing.T) {
" └─TableRowIDScan 27.00 cop[tikv] table:l2 keep order:false"))
tk.MustQuery("select * from t l1 where exists ( select * from t l2 where l2.l_orderkey = l1.l_orderkey and l2.l_suppkey <> l1.l_suppkey )order by `l_orderkey`,`l_linenumber`;").Check(testkit.Rows("0 0 0 0", "0 1 0 1", "0 2 0 0", "1 0 1 0", "1 1 1 1", "1 2 1 0", "2 0 0 0", "2 1 0 1", "2 2 0 0"))
tk.MustQuery("desc format = 'brief' select count(*) from t l1 where exists ( select * from t l2 where l2.l_orderkey = l1.l_orderkey and l2.l_suppkey <> l1.l_suppkey );").Check(testkit.Rows(
"StreamAgg 1.00 root funcs:count(1)->Column#11",
"HashAgg 1.00 root funcs:count(1)->Column#11",
"└─IndexHashJoin 7.20 root semi join, inner:IndexLookUp, outer key:test.t.l_orderkey, inner key:test.t.l_orderkey, equal cond:eq(test.t.l_orderkey, test.t.l_orderkey), other cond:ne(test.t.l_suppkey, test.t.l_suppkey)",
" ├─TableReader(Build) 9.00 root data:Selection",
" │ └─Selection 9.00 cop[tikv] not(isnull(test.t.l_suppkey))",
Expand Down
1 change: 1 addition & 0 deletions executor/oomtest/oom_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ func TestMemTracker4DeleteExec(t *testing.T) {

tk := testkit.NewTestKit(t, store)
tk.MustExec("use test")
tk.MustExec("set tidb_cost_model_version=1")
tk.MustExec("create table MemTracker4DeleteExec1 (id int, a int, b int, index idx_a(`a`))")
tk.MustExec("create table MemTracker4DeleteExec2 (id int, a int, b int, index idx_a(`a`))")

Expand Down
25 changes: 13 additions & 12 deletions executor/partition_table_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2115,6 +2115,7 @@ func TestParallelApply(t *testing.T) {

tk := testkit.NewTestKit(t, store)
tk.MustExec("use test")
tk.MustExec("set tidb_cost_model_version=2")
tk.MustExec("create database test_parallel_apply")
tk.MustExec("use test_parallel_apply")
tk.MustExec("set @@tidb_partition_prune_mode = 'dynamic'")
Expand Down Expand Up @@ -2149,9 +2150,9 @@ func TestParallelApply(t *testing.T) {
`└─Apply 10000.00 root CARTESIAN inner join, other cond:gt(cast(test_parallel_apply.touter.a, decimal(10,0) BINARY), Column#7)`,
` ├─TableReader(Build) 10000.00 root data:TableFullScan`,
` │ └─TableFullScan 10000.00 cop[tikv] table:touter keep order:false, stats:pseudo`,
` └─StreamAgg(Probe) 10000.00 root funcs:sum(Column#9)->Column#7`,
` └─IndexReader 10000.00 root partition:all index:StreamAgg`, // IndexReader is a inner child of Apply
` └─StreamAgg 10000.00 cop[tikv] funcs:sum(test_parallel_apply.thash.a)->Column#9`,
` └─HashAgg(Probe) 10000.00 root funcs:sum(Column#8)->Column#7`,
` └─IndexReader 10000.00 root partition:all index:HashAgg`, // IndexReader is a inner child of Apply
` └─HashAgg 10000.00 cop[tikv] funcs:sum(test_parallel_apply.thash.a)->Column#8`,
` └─Selection 80000000.00 cop[tikv] gt(test_parallel_apply.thash.a, test_parallel_apply.touter.b)`,
` └─IndexFullScan 100000000.00 cop[tikv] table:thash, index:a(a) keep order:false, stats:pseudo`))
tk.MustQuery(`select * from touter where touter.a > (select sum(thash.a) from thash use index(a) where thash.a>touter.b)`).Sort().Check(
Expand All @@ -2163,9 +2164,9 @@ func TestParallelApply(t *testing.T) {
`└─Apply 10000.00 root CARTESIAN inner join, other cond:gt(cast(test_parallel_apply.touter.a, decimal(10,0) BINARY), Column#7)`,
` ├─TableReader(Build) 10000.00 root data:TableFullScan`,
` │ └─TableFullScan 10000.00 cop[tikv] table:touter keep order:false, stats:pseudo`,
` └─StreamAgg(Probe) 10000.00 root funcs:sum(Column#9)->Column#7`,
` └─TableReader 10000.00 root partition:all data:StreamAgg`, // TableReader is a inner child of Apply
` └─StreamAgg 10000.00 cop[tikv] funcs:sum(test_parallel_apply.thash.b)->Column#9`,
` └─HashAgg(Probe) 10000.00 root funcs:sum(Column#8)->Column#7`,
` └─TableReader 10000.00 root partition:all data:HashAgg`, // TableReader is a inner child of Apply
` └─HashAgg 10000.00 cop[tikv] funcs:sum(test_parallel_apply.thash.b)->Column#8`,
` └─Selection 80000000.00 cop[tikv] gt(test_parallel_apply.thash.a, test_parallel_apply.touter.b)`,
` └─TableFullScan 100000000.00 cop[tikv] table:thash keep order:false, stats:pseudo`))
tk.MustQuery(`select * from touter where touter.a > (select sum(thash.b) from thash ignore index(a) where thash.a>touter.b)`).Sort().Check(
Expand All @@ -2192,9 +2193,9 @@ func TestParallelApply(t *testing.T) {
`└─Apply 10000.00 root CARTESIAN inner join, other cond:gt(cast(test_parallel_apply.touter.a, decimal(10,0) BINARY), Column#7)`,
` ├─TableReader(Build) 10000.00 root data:TableFullScan`,
` │ └─TableFullScan 10000.00 cop[tikv] table:touter keep order:false, stats:pseudo`,
` └─StreamAgg(Probe) 10000.00 root funcs:sum(Column#9)->Column#7`,
` └─IndexReader 10000.00 root partition:all index:StreamAgg`, // IndexReader is a inner child of Apply
` └─StreamAgg 10000.00 cop[tikv] funcs:sum(test_parallel_apply.trange.a)->Column#9`,
` └─HashAgg(Probe) 10000.00 root funcs:sum(Column#8)->Column#7`,
` └─IndexReader 10000.00 root partition:all index:HashAgg`, // IndexReader is a inner child of Apply
` └─HashAgg 10000.00 cop[tikv] funcs:sum(test_parallel_apply.trange.a)->Column#8`,
` └─Selection 80000000.00 cop[tikv] gt(test_parallel_apply.trange.a, test_parallel_apply.touter.b)`,
` └─IndexFullScan 100000000.00 cop[tikv] table:trange, index:a(a) keep order:false, stats:pseudo`))
tk.MustQuery(`select * from touter where touter.a > (select sum(trange.a) from trange use index(a) where trange.a>touter.b)`).Sort().Check(
Expand All @@ -2206,9 +2207,9 @@ func TestParallelApply(t *testing.T) {
`└─Apply 10000.00 root CARTESIAN inner join, other cond:gt(cast(test_parallel_apply.touter.a, decimal(10,0) BINARY), Column#7)`,
` ├─TableReader(Build) 10000.00 root data:TableFullScan`,
` │ └─TableFullScan 10000.00 cop[tikv] table:touter keep order:false, stats:pseudo`,
` └─StreamAgg(Probe) 10000.00 root funcs:sum(Column#9)->Column#7`,
` └─TableReader 10000.00 root partition:all data:StreamAgg`, // TableReader is a inner child of Apply
` └─StreamAgg 10000.00 cop[tikv] funcs:sum(test_parallel_apply.trange.b)->Column#9`,
` └─HashAgg(Probe) 10000.00 root funcs:sum(Column#8)->Column#7`,
` └─TableReader 10000.00 root partition:all data:HashAgg`, // TableReader is a inner child of Apply
` └─HashAgg 10000.00 cop[tikv] funcs:sum(test_parallel_apply.trange.b)->Column#8`,
` └─Selection 80000000.00 cop[tikv] gt(test_parallel_apply.trange.a, test_parallel_apply.touter.b)`,
` └─TableFullScan 100000000.00 cop[tikv] table:trange keep order:false, stats:pseudo`))
tk.MustQuery(`select * from touter where touter.a > (select sum(trange.b) from trange ignore index(a) where trange.a>touter.b)`).Sort().Check(
Expand Down
1 change: 1 addition & 0 deletions executor/prepared_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,7 @@ func TestPlanCacheWithDifferentVariableTypes(t *testing.T) {
store := testkit.CreateMockStore(t)
tk := testkit.NewTestKit(t, store)
tk.MustExec(`set tidb_enable_prepared_plan_cache=1`)
tk.MustExec("set tidb_cost_model_version=1")
tk.MustExec("use test")
tk.MustExec("drop table if exists t1, t2")
tk.MustExec("set @@tidb_enable_collect_execution_info=0;")
Expand Down
72 changes: 37 additions & 35 deletions planner/core/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2880,6 +2880,7 @@ func TestBitColumnPushDown(t *testing.T) {
store := testkit.CreateMockStore(t)
tk := testkit.NewTestKit(t, store)
tk.MustExec("use test")
tk.MustExec("set tidb_cost_model_version=1")
tk.MustExec("create table t1(a bit(8), b int)")
tk.MustExec("create table t2(a bit(8), b int)")
tk.MustExec("insert into t1 values ('1', 1), ('2', 2), ('3', 3), ('4', 4), ('1', 1), ('2', 2), ('3', 3), ('4', 4)")
Expand Down Expand Up @@ -5693,6 +5694,7 @@ func TestIndexJoinCost(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_outer, t_inner_pk, t_inner_idx`)
tk.MustExec(`create table t_outer (a int)`)
tk.MustExec(`create table t_inner_pk (a int primary key)`)
Expand All @@ -5702,46 +5704,46 @@ func TestIndexJoinCost(t *testing.T) {
tk.MustExec("set @@tidb_enable_chunk_rpc = on")

tk.MustQuery(`explain format=verbose select /*+ TIDB_INLJ(t_outer, t_inner_pk) */ * from t_outer, t_inner_pk where t_outer.a=t_inner_pk.a`).Check(testkit.Rows( // IndexJoin with inner TableScan
`IndexJoin_11 12487.50 206368.09 root inner join, inner:TableReader_8, outer key:test.t_outer.a, inner key:test.t_inner_pk.a, equal cond:eq(test.t_outer.a, test.t_inner_pk.a)`,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected, just update cost values.

`├─TableReader_18(Build) 9990.00 36412.58 root data:Selection_17`,
`│ └─Selection_17 9990.00 465000.00 cop[tikv] not(isnull(test.t_outer.a))`,
`│ └─TableFullScan_16 10000.00 435000.00 cop[tikv] table:t_outer keep order:false, stats:pseudo`,
`└─TableReader_8(Probe) 9990.00 3.88 root data:TableRangeScan_7`,
` └─TableRangeScan_7 9990.00 30.00 cop[tikv] table:t_inner_pk range: decided by [test.t_outer.a], keep order:false, stats:pseudo`))
`IndexJoin_11 12487.50 11918182.35 root inner join, inner:TableReader_8, outer key:test.t_outer.a, inner key:test.t_inner_pk.a, equal cond:eq(test.t_outer.a, test.t_inner_pk.a)`,
`├─TableReader_18(Build) 9990.00 211131.09 root data:Selection_17`,
`│ └─Selection_17 9990.00 2534000.00 cop[tikv] not(isnull(test.t_outer.a))`,
`│ └─TableFullScan_16 10000.00 2035000.00 cop[tikv] table:t_outer keep order:false, stats:pseudo`,
`└─TableReader_8(Probe) 9990.00 10.25 root data:TableRangeScan_7`,
` └─TableRangeScan_7 9990.00 122.10 cop[tikv] table:t_inner_pk range: decided by [test.t_outer.a], keep order:false, stats:pseudo`))
tk.MustQuery(`explain format=verbose select /*+ TIDB_INLJ(t_outer, t_inner_idx) */ t_inner_idx.a from t_outer, t_inner_idx where t_outer.a=t_inner_idx.a`).Check(testkit.Rows( // IndexJoin with inner IndexScan
`IndexJoin_10 12487.50 235192.19 root inner join, inner:IndexReader_9, outer key:test.t_outer.a, inner key:test.t_inner_idx.a, equal cond:eq(test.t_outer.a, test.t_inner_idx.a)`,
`├─TableReader_20(Build) 9990.00 36412.58 root data:Selection_19`,
`│ └─Selection_19 9990.00 465000.00 cop[tikv] not(isnull(test.t_outer.a))`,
`│ └─TableFullScan_18 10000.00 435000.00 cop[tikv] table:t_outer keep order:false, stats:pseudo`,
`└─IndexReader_9(Probe) 12487.50 5.89 root index:Selection_8`,
` └─Selection_8 12487.50 58.18 cop[tikv] not(isnull(test.t_inner_idx.a))`,
` └─IndexRangeScan_7 12500.00 54.43 cop[tikv] table:t_inner_idx, index:a(a) range: decided by [eq(test.t_inner_idx.a, test.t_outer.a)], keep order:false, stats:pseudo`))
`IndexJoin_10 12487.50 11918207.26 root inner join, inner:IndexReader_9, outer key:test.t_outer.a, inner key:test.t_inner_idx.a, equal cond:eq(test.t_outer.a, test.t_inner_idx.a)`,
`├─TableReader_20(Build) 9990.00 211131.09 root data:Selection_19`,
`│ └─Selection_19 9990.00 2534000.00 cop[tikv] not(isnull(test.t_outer.a))`,
`│ └─TableFullScan_18 10000.00 2035000.00 cop[tikv] table:t_outer keep order:false, stats:pseudo`,
`└─IndexReader_9(Probe) 12487.50 23.02 root index:Selection_8`,
` └─Selection_8 12487.50 266.14 cop[tikv] not(isnull(test.t_inner_idx.a))`,
` └─IndexRangeScan_7 12500.00 203.70 cop[tikv] table:t_inner_idx, index:a(a) range: decided by [eq(test.t_inner_idx.a, test.t_outer.a)], keep order:false, stats:pseudo`))
tk.MustQuery(`explain format=verbose select /*+ TIDB_INLJ(t_outer, t_inner_idx) */ * from t_outer, t_inner_idx where t_outer.a=t_inner_idx.a`).Check(testkit.Rows( // IndexJoin with inner IndexLookup
`IndexJoin_11 12487.50 531469.38 root inner join, inner:IndexLookUp_10, outer key:test.t_outer.a, inner key:test.t_inner_idx.a, equal cond:eq(test.t_outer.a, test.t_inner_idx.a)`,
`├─TableReader_23(Build) 9990.00 36412.58 root data:Selection_22`,
`│ └─Selection_22 9990.00 465000.00 cop[tikv] not(isnull(test.t_outer.a))`,
`│ └─TableFullScan_21 10000.00 435000.00 cop[tikv] table:t_outer keep order:false, stats:pseudo`,
`└─IndexLookUp_10(Probe) 12487.50 35.55 root `,
` ├─Selection_9(Build) 12487.50 75.08 cop[tikv] not(isnull(test.t_inner_idx.a))`,
` │ └─IndexRangeScan_7 12500.00 71.32 cop[tikv] table:t_inner_idx, index:a(a) range: decided by [eq(test.t_inner_idx.a, test.t_outer.a)], keep order:false, stats:pseudo`,
` └─TableRowIDScan_8(Probe) 12487.50 71.25 cop[tikv] table:t_inner_idx keep order:false, stats:pseudo`))
`IndexJoin_11 12487.50 11922930.69 root inner join, inner:IndexLookUp_10, outer key:test.t_outer.a, inner key:test.t_inner_idx.a, equal cond:eq(test.t_outer.a, test.t_inner_idx.a)`,
`├─TableReader_23(Build) 9990.00 211131.09 root data:Selection_22`,
`│ └─Selection_22 9990.00 2534000.00 cop[tikv] not(isnull(test.t_outer.a))`,
`│ └─TableFullScan_21 10000.00 2035000.00 cop[tikv] table:t_outer keep order:false, stats:pseudo`,
`└─IndexLookUp_10(Probe) 12487.50 2443.84 root `,
` ├─Selection_9(Build) 12487.50 317.07 cop[tikv] not(isnull(test.t_inner_idx.a))`,
` │ └─IndexRangeScan_7 12500.00 254.63 cop[tikv] table:t_inner_idx, index:a(a) range: decided by [eq(test.t_inner_idx.a, test.t_outer.a)], keep order:false, stats:pseudo`,
` └─TableRowIDScan_8(Probe) 12487.50 284.13 cop[tikv] table:t_inner_idx keep order:false, stats:pseudo`))

tk.MustQuery("explain format=verbose select /*+ inl_hash_join(t_outer, t_inner_idx) */ t_inner_idx.a from t_outer, t_inner_idx where t_outer.a=t_inner_idx.a").Check(testkit.Rows(
`IndexHashJoin_12 12487.50 235192.19 root inner join, inner:IndexReader_9, outer key:test.t_outer.a, inner key:test.t_inner_idx.a, equal cond:eq(test.t_outer.a, test.t_inner_idx.a)`,
`├─TableReader_20(Build) 9990.00 36412.58 root data:Selection_19`,
`│ └─Selection_19 9990.00 465000.00 cop[tikv] not(isnull(test.t_outer.a))`,
`│ └─TableFullScan_18 10000.00 435000.00 cop[tikv] table:t_outer keep order:false, stats:pseudo`,
`└─IndexReader_9(Probe) 12487.50 5.89 root index:Selection_8`,
` └─Selection_8 12487.50 58.18 cop[tikv] not(isnull(test.t_inner_idx.a))`,
` └─IndexRangeScan_7 12500.00 54.43 cop[tikv] table:t_inner_idx, index:a(a) range: decided by [eq(test.t_inner_idx.a, test.t_outer.a)], keep order:false, stats:pseudo`))
`IndexHashJoin_12 12487.50 11918207.26 root inner join, inner:IndexReader_9, outer key:test.t_outer.a, inner key:test.t_inner_idx.a, equal cond:eq(test.t_outer.a, test.t_inner_idx.a)`,
`├─TableReader_20(Build) 9990.00 211131.09 root data:Selection_19`,
`│ └─Selection_19 9990.00 2534000.00 cop[tikv] not(isnull(test.t_outer.a))`,
`│ └─TableFullScan_18 10000.00 2035000.00 cop[tikv] table:t_outer keep order:false, stats:pseudo`,
`└─IndexReader_9(Probe) 12487.50 23.02 root index:Selection_8`,
` └─Selection_8 12487.50 266.14 cop[tikv] not(isnull(test.t_inner_idx.a))`,
` └─IndexRangeScan_7 12500.00 203.70 cop[tikv] table:t_inner_idx, index:a(a) range: decided by [eq(test.t_inner_idx.a, test.t_outer.a)], keep order:false, stats:pseudo`))
tk.MustQuery("explain format=verbose select /*+ inl_merge_join(t_outer, t_inner_idx) */ t_inner_idx.a from t_outer, t_inner_idx where t_outer.a=t_inner_idx.a").Check(testkit.Rows(
`IndexMergeJoin_17 12487.50 229210.68 root inner join, inner:IndexReader_15, outer key:test.t_outer.a, inner key:test.t_inner_idx.a`,
`├─TableReader_20(Build) 9990.00 36412.58 root data:Selection_19`,
`│ └─Selection_19 9990.00 465000.00 cop[tikv] not(isnull(test.t_outer.a))`,
`│ └─TableFullScan_18 10000.00 435000.00 cop[tikv] table:t_outer keep order:false, stats:pseudo`,
`└─IndexReader_15(Probe) 12487.50 5.89 root index:Selection_14`,
` └─Selection_14 12487.50 58.18 cop[tikv] not(isnull(test.t_inner_idx.a))`,
` └─IndexRangeScan_13 12500.00 54.43 cop[tikv] table:t_inner_idx, index:a(a) range: decided by [eq(test.t_inner_idx.a, test.t_outer.a)], keep order:true, stats:pseudo`))
`IndexMergeJoin_17 12487.50 11918207.26 root inner join, inner:IndexReader_15, outer key:test.t_outer.a, inner key:test.t_inner_idx.a`,
`├─TableReader_20(Build) 9990.00 211131.09 root data:Selection_19`,
`│ └─Selection_19 9990.00 2534000.00 cop[tikv] not(isnull(test.t_outer.a))`,
`│ └─TableFullScan_18 10000.00 2035000.00 cop[tikv] table:t_outer keep order:false, stats:pseudo`,
`└─IndexReader_15(Probe) 12487.50 23.02 root index:Selection_14`,
` └─Selection_14 12487.50 266.14 cop[tikv] not(isnull(test.t_inner_idx.a))`,
` └─IndexRangeScan_13 12500.00 203.70 cop[tikv] table:t_inner_idx, index:a(a) range: decided by [eq(test.t_inner_idx.a, test.t_outer.a)], keep order:true, stats:pseudo`))
}

func TestHeuristicIndexSelection(t *testing.T) {
Expand Down
2 changes: 2 additions & 0 deletions planner/core/partition_pruner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ func TestListPartitionPruner(t *testing.T) {
tk.MustExec("drop database if exists test_partition;")
tk.MustExec("create database test_partition")
tk.MustExec("use test_partition")
tk.MustExec("set tidb_cost_model_version=2")
tk.Session().GetSessionVars().EnableClusteredIndex = variable.ClusteredIndexDefModeIntOnly
tk.MustExec("set @@session.tidb_enable_list_partition = ON")
tk.MustExec(`set @@session.tidb_regard_null_as_point=false`)
Expand Down Expand Up @@ -331,6 +332,7 @@ func TestListColumnsPartitionPruner(t *testing.T) {
defer failpoint.Disable("github.com/pingcap/tidb/planner/core/forceDynamicPrune")
store := testkit.CreateMockStore(t)
tk := testkit.NewTestKit(t, store)
tk.MustExec("set tidb_cost_model_version=2")
tk.MustExec("set @@session.tidb_enable_list_partition = ON")
tk.MustExec("drop database if exists test_partition;")
tk.MustExec("create database test_partition")
Expand Down
Loading