28 lines
1.9 KiB
Plaintext
28 lines
1.9 KiB
Plaintext
set tidb_cost_model_version=1;
|
|
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 format = 'plan_tree' select count(*) from e, lo where lo.a=e.a and e.b=22336;
|
|
id task access object operator info
|
|
HashAgg root funcs:count(1)->Column
|
|
└─HashJoin root inner join, equal:[eq(explain_join_stats.lo.a, explain_join_stats.e.a)]
|
|
├─TableReader(Build) root data:TableFullScan
|
|
│ └─TableFullScan cop[tikv] table:lo keep order:false
|
|
└─IndexLookUp(Probe) root
|
|
├─IndexRangeScan(Build) cop[tikv] table:e, index:idx_b(b) range:[22336,22336], keep order:false
|
|
└─Selection(Probe) cop[tikv] not(isnull(explain_join_stats.e.a))
|
|
└─TableRowIDScan cop[tikv] table:e keep order:false
|
|
explain format = 'plan_tree' select /*+ TIDB_INLJ(e) */ count(*) from e, lo where lo.a=e.a and e.b=22336;
|
|
id task access object operator info
|
|
HashAgg root funcs:count(1)->Column
|
|
└─IndexJoin root inner join, inner:IndexLookUp, outer key:explain_join_stats.lo.a, inner key:explain_join_stats.e.a, equal cond:eq(explain_join_stats.lo.a, explain_join_stats.e.a)
|
|
├─TableReader(Build) root data:TableFullScan
|
|
│ └─TableFullScan cop[tikv] table:lo keep order:false
|
|
└─IndexLookUp(Probe) root
|
|
├─Selection(Build) cop[tikv] not(isnull(explain_join_stats.e.a))
|
|
│ └─IndexRangeScan cop[tikv] table:e, index:idx_a(a) range: decided by [eq(explain_join_stats.e.a, explain_join_stats.lo.a)], keep order:false
|
|
└─Selection(Probe) cop[tikv] eq(explain_join_stats.e.b, 22336)
|
|
└─TableRowIDScan cop[tikv] table:e keep order:false
|