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.
 
 

27 lines
1.9 KiB

use test;
drop table if exists e, lo;
create table e(a int, b int, key idx_a(a), key idx_b(b)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
load stats 's/explain_join_stats_e.json';
create table lo(a int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (a)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin AUTO_INCREMENT=30002;
load stats 's/explain_join_stats_lo.json';
explain select count(*) from e, lo where lo.a=e.a and e.b=22336;
id estRows task access object operator info
StreamAgg_13 1.00 root funcs:count(1)->Column#5
└─HashJoin_65 19977.00 root inner join, equal:[eq(test.lo.a, test.e.a)]
├─TableReader_38(Build) 250.00 root data:TableFullScan_37
│ └─TableFullScan_37 250.00 cop[tikv] table:lo keep order:false
└─IndexLookUp_49(Probe) 19977.00 root
├─IndexRangeScan_46(Build) 19977.00 cop[tikv] table:e, index:idx_b(b) range:[22336,22336], keep order:false
└─Selection_48(Probe) 19977.00 cop[tikv] not(isnull(test.e.a))
└─TableRowIDScan_47 19977.00 cop[tikv] table:e keep order:false
explain select /*+ TIDB_INLJ(e) */ count(*) from e, lo where lo.a=e.a and e.b=22336;
id estRows task access object operator info
StreamAgg_12 1.00 root funcs:count(1)->Column#5
└─IndexJoin_40 19977.00 root inner join, inner:IndexLookUp_39, outer key:test.lo.a, inner key:test.e.a, equal cond:eq(test.lo.a, test.e.a)
├─TableReader_28(Build) 250.00 root data:TableFullScan_27
│ └─TableFullScan_27 250.00 cop[tikv] table:lo keep order:false
└─IndexLookUp_39(Probe) 79.91 root
├─Selection_37(Build) 4080.00 cop[tikv] not(isnull(test.e.a))
│ └─IndexRangeScan_35 4080.00 cop[tikv] table:e, index:idx_a(a) range: decided by [eq(test.e.a, test.lo.a)], keep order:false
└─Selection_38(Probe) 79.91 cop[tikv] eq(test.e.b, 22336)
└─TableRowIDScan_36 4080.00 cop[tikv] table:e keep order:false