[MDEV-28818] Eliminate derived tables having DISTINCT and/or UNION Created: 2022-06-13  Updated: 2023-10-30

Status: Open
Project: MariaDB Server
Component/s: None
Fix Version/s: 11.5

Type: Task Priority: Major
Reporter: Oleg Smirnov Assignee: Oleg Smirnov
Resolution: Unresolved Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-26278 Table elimination does not work acros... Closed

 Description   

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;


Generated at Thu Feb 08 10:03:42 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.