Can you give an example using real-ish tables eg customers, products, orders.  
And show the 2 sql statements that you allege to be equivalent. I have a 
feeling that it’s important which join keys you use. 

Julian

Ps also please join the list so that you get replies. 

> On Mar 27, 2020, at 9:57 AM, Chris Channing <[email protected]> 
> wrote:
> 
> Hey Folks,
> 
> Is it currently possible to have Calcite optimize-away unnecessary joins?
> The case I'm thinking of is where (hopefully the formatting holds up!):
> 
> ...you have a bushy tree as follows:
> 
>     ---------------------
>     |                       |
>     |                       |
> |--------|             |---------|
> T1     T2          T2       T3
> 
> ...which could be rewritten as a left-deep tree to avoid scanning T2 again:
> 
>        |-------------------|
>        |                       |
>  |----------|                |
> T1         T2             T3
> 
> If so, does any have an example of how to do this please?
> 
> Many thanks,
> Chris

Reply via email to