Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
For t1 INNER JOIN t2 ON (non-eq conditions) LEFT JOIN t3 ON (eq conditions), we can't use the hint to enforce the join order.
create table t1(a int, b int, c int);
create table t2(a int, b int, c int);
create table t3(a int, b int, c int);
explain select /*+ leading(t1,t3,t2) */ * from t1 join t2 on (t1.a = t2.a or t1.a = t2.b) left join t3 on t1.a = t3.b;
explain select /*+ leading(t1,t2,t3) */ * from t1 join t2 on (t1.a = t2.a or t1.a = t2.b) left join t3 on t1.a = t3.b;
2. What did you expect to see? (Required)
The hint should work well in both queries, meaning two execution plans should be different.
Bug Report
Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
For
t1 INNER JOIN t2 ON (non-eq conditions) LEFT JOIN t3 ON (eq conditions)
, we can't use the hint to enforce the join order.2. What did you expect to see? (Required)
The hint should work well in both queries, meaning two execution plans should be different.
3. What did you see instead (Required)
4. What is your TiDB version? (Required)
From v6.2.0 (when the
leading
hint starts support outer join) until the latest nightly (v8.4.0-alpha-nightly)