|
MDEV-26278 only considers derived tables having GROUP BY expressions. But if a derived table has SELECT DISTINCT this can also be considered as if table has a unique key on selected fields, and so can be a subject to elimination:
select t1.* from t1 left join (select distinct a from t2) D on D.a=t1.a;
|
Also MDEV-26278 does not implement elimination for derived tables with UNION, though it seems possible:
select t1.* from t1 left join
|
(select distinct a from t2
|
union
|
select distinct a from t3) D
|
on D.a=t1.a;
|
|