Files
tidb/cmd/explaintest/r/explain_join_stats.result

28 lines
1.8 KiB
Plaintext

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 count task operator info
StreamAgg_13 1.00 root funcs:count(1)->Column#5
└─HashRightJoin_89 19977.00 root inner join, inner:TableReader_50, equal:[eq(test.lo.a, test.e.a)]
├─TableReader_50 250.00 root data:TableScan_49
│ └─TableScan_49 250.00 cop[tikv] table:lo, range:[-inf,+inf], keep order:false
└─IndexLookUp_61 19977.00 root
├─IndexScan_58 19977.00 cop[tikv] table:e, index:b, range:[22336,22336], keep order:false
└─Selection_60 19977.00 cop[tikv] not(isnull(test.e.a))
└─TableScan_59 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 count task operator info
StreamAgg_12 1.00 root funcs:count(1)->Column#5
└─IndexJoin_56 19977.00 root inner join, inner:IndexLookUp_55, outer key:test.lo.a, inner key:test.e.a
├─IndexLookUp_55 79.91 root
│ ├─Selection_53 4080.00 cop[tikv] not(isnull(test.e.a))
│ │ └─IndexScan_51 4080.00 cop[tikv] table:e, index:a, range: decided by [eq(test.e.a, test.lo.a)], keep order:false
│ └─Selection_54 79.91 cop[tikv] eq(test.e.b, 22336)
│ └─TableScan_52 4080.00 cop[tikv] table:e, keep order:false
└─TableReader_40 250.00 root data:TableScan_39
└─TableScan_39 250.00 cop[tikv] table:lo, range:[-inf,+inf], keep order:false