MonetDB icon indicating copy to clipboard operation
MonetDB copied to clipboard

missed GROUP BY optimization on JOIN with simple equality condition

Open smavros opened this issue 2 years ago • 0 comments

the GROUP BY common sub-expression elimination (CSE) optimizer is not acting upon

select f.n, b.n from f join b on f.n = b.n group by f.n, b.n;

the PLAN indicates two grouping columns even though they are going to have same values

project (                                    
| group by (                                 
| | join (                                   
| | | table("sys"."f") [ "f"."n" ],          
| | | table("sys"."b") [ "b"."n" ]           
| | ) [ ("f"."n") = ("b"."n") ]              
| ) [ "b"."n", "f"."n" ] [ "f"."n", "b"."n" ]
) [ "f"."n", "b"."n" ]                       

this is going to be probably tricky since the optimizer need to parse the subrelation operator's expression tree and understand the semantics

tested on default at b0f51c763c66 (mercurial changeset)

smavros avatar Mar 24 '23 17:03 smavros