create table t(a int, b int, c int);
create table t1(a int, b int, c int);
alter table t set tiflash replica 1;
alter table t1 set tiflash replica 1;
-- wait a moment
explain select * from t left join t1 on t.a = t1.a where t.b > 1; -- note the left join, which limits the choice of broadcast join
explain select /*+ hash_join_probe(t1) */ * from t left join t1 on t.a = t1.a where t.b > 1;
explain select /*+ shuffle_join(t1), hash_join_probe(t1) */ * from t left join t1 on t.a = t1.a where t.b > 1;
Ideally, the last two SQLs should have the same plan. hash_join_probe(t1) should already be enough since there's no ambiguity.
But actually, we need shuffle_join(t1) to enforce t1 to be the probe side.
Enhancement
Ideally, the last two SQLs should have the same plan.
hash_join_probe(t1)
should already be enough since there's no ambiguity. But actually, we needshuffle_join(t1)
to enforcet1
to be the probe side.