应该是bug来着,6.5.6以上的版本应该修复了
opened 12:26PM - 16 Aug 23 UTC
closed 12:36PM - 21 Aug 23 UTC
type/bug
sig/planner
severity/moderate
affects-6.5
epic/hint
affects-7.1
affects-7.5
## Enhancement
```
create table t1 (a int, key(a));
create table t2 (a int, k… ey(a));
explain select /*+ tidb_inlj(bb) */ aa.* from
(select * from t1) as aa
left join
(select t2.a, t2.a*2 as a2 from t2) as bb
on aa.a=bb.a;
mysql> show warnings;
+---------+------+--------------------------------------------------------------------------------------------------------------------------------------------------+
| Level | Code | Message |
+---------+------+--------------------------------------------------------------------------------------------------------------------------------------------------+
| Warning | 1815 | There are no matching table names for (bb) in optimizer hint /*+ INL_JOIN(bb) */ or /*+ TIDB_INLJ(bb) */. Maybe you can use the table alias name |
+---------+------+--------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
```
也可以通过下面这种方式绕一下
select /*+hash_join_probe(q) */ q.a,q.b from (
select a,b from table1 partition(p0520) where c >100 group by a,b) as n join table1 partition(p0520) q on n.a=q.a group by a,b;