You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
54 lines
3.4 KiB
54 lines
3.4 KiB
drop table if exists t1, t2;
|
|
create table t1(a bigint, b bigint, index idx(a));
|
|
create table t2(a bigint, b bigint, index idx(a));
|
|
insert into t1 values(1, 1), (1, 1), (1, 1), (1, 1), (1, 1);
|
|
insert into t2 values(1, 1);
|
|
analyze table t1, t2;
|
|
set session tidb_hashagg_partial_concurrency = 1;
|
|
set session tidb_hashagg_final_concurrency = 1;
|
|
explain select /*+ TIDB_INLJ(t1, t2) */ * from t1 join t2 on t1.a=t2.a;
|
|
id estRows task access object operator info
|
|
IndexJoin_18 5.00 root inner join, inner:IndexLookUp_17, outer key:test.t2.a, inner key:test.t1.a, equal cond:eq(test.t2.a, test.t1.a)
|
|
├─TableReader_29(Build) 1.00 root data:Selection_28
|
|
│ └─Selection_28 1.00 cop[tikv] not(isnull(test.t2.a))
|
|
│ └─TableFullScan_27 1.00 cop[tikv] table:t2 keep order:false
|
|
└─IndexLookUp_17(Probe) 5.00 root
|
|
├─Selection_16(Build) 5.00 cop[tikv] not(isnull(test.t1.a))
|
|
│ └─IndexRangeScan_14 5.00 cop[tikv] table:t1, index:idx(a) range: decided by [eq(test.t1.a, test.t2.a)], keep order:false
|
|
└─TableRowIDScan_15(Probe) 5.00 cop[tikv] table:t1 keep order:false
|
|
explain select * from t1 join t2 on t1.a=t2.a;
|
|
id estRows task access object operator info
|
|
Projection_6 5.00 root test.t1.a, test.t1.b, test.t2.a, test.t2.b
|
|
└─HashJoin_23 5.00 root inner join, equal:[eq(test.t2.a, test.t1.a)]
|
|
├─TableReader_34(Build) 1.00 root data:Selection_33
|
|
│ └─Selection_33 1.00 cop[tikv] not(isnull(test.t2.a))
|
|
│ └─TableFullScan_32 1.00 cop[tikv] table:t2 keep order:false
|
|
└─TableReader_40(Probe) 5.00 root data:Selection_39
|
|
└─Selection_39 5.00 cop[tikv] not(isnull(test.t1.a))
|
|
└─TableFullScan_38 5.00 cop[tikv] table:t1 keep order:false
|
|
drop table if exists t1, t2;
|
|
create table t1(a int not null, b int not null);
|
|
create table t2(a int not null, b int not null, key a(a));
|
|
set @@tidb_opt_insubq_to_join_and_agg=0;
|
|
explain select /*+ TIDB_INLJ(t2@sel_2) */ * from t1 where t1.a in (select t2.a from t2);
|
|
id estRows task access object operator info
|
|
IndexJoin_10 8000.00 root semi join, inner:IndexReader_9, outer key:test.t1.a, inner key:test.t2.a, equal cond:eq(test.t1.a, test.t2.a)
|
|
├─TableReader_14(Build) 10000.00 root data:TableFullScan_13
|
|
│ └─TableFullScan_13 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo
|
|
└─IndexReader_9(Probe) 1.25 root index:IndexRangeScan_8
|
|
└─IndexRangeScan_8 1.25 cop[tikv] table:t2, index:a(a) range: decided by [eq(test.t2.a, test.t1.a)], keep order:false, stats:pseudo
|
|
show warnings;
|
|
Level Code Message
|
|
set @@tidb_opt_insubq_to_join_and_agg=1;
|
|
drop table if exists t1, t2;
|
|
create table t1(a int not null, b int not null, key a(a));
|
|
create table t2(a int not null, b int not null, key a(a));
|
|
explain select /*+ TIDB_INLJ(t1) */ * from t1 where t1.a in (select t2.a from t2);
|
|
id estRows task access object operator info
|
|
IndexJoin_13 10000.00 root inner join, inner:IndexLookUp_12, outer key:test.t2.a, inner key:test.t1.a, equal cond:eq(test.t2.a, test.t1.a)
|
|
├─StreamAgg_20(Build) 8000.00 root group by:test.t2.a, funcs:firstrow(test.t2.a)->test.t2.a
|
|
│ └─IndexReader_33 10000.00 root index:IndexFullScan_32
|
|
│ └─IndexFullScan_32 10000.00 cop[tikv] table:t2, index:a(a) keep order:true, stats:pseudo
|
|
└─IndexLookUp_12(Probe) 1.25 root
|
|
├─IndexRangeScan_10(Build) 1.25 cop[tikv] table:t1, index:a(a) range: decided by [eq(test.t1.a, test.t2.a)], keep order:false, stats:pseudo
|
|
└─TableRowIDScan_11(Probe) 1.25 cop[tikv] table:t1 keep order:false, stats:pseudo
|
|
|