Subject Re: [firebird-support] Query optimization - Why this plan ?
Author Ann W. Harrison
Alexandre Benson Smith wrote:
>
>>Alexander, out of curiosity, what happens if you put the e.name
>>restriction into the "on" clause of the first join?
>>
>> JOIN Cliente c
>> ON (e.EmpresaId = c.EmpresaId
>> and e.Nome = 'Alexandre Benson Smith')
>>
>
> The good plan !
>

Sorry it doesn't solve your problem, but it may be a clue as to why the
optimizer is confused. If you change all outer joins to inner joins, do
you get the same results? My hypothesis is that the query compiler is
being a bit too conservative about distribution equalities across all
join terms in input stream in the presence of am outer join.

Regards,


Ann