Subject Re: [firebird-support] another make my query faster question
Author Ann W. Harrison
Alexandre Benson Smith wrote:
> I understand the diference between inner and outer joins, but sometimes
> I use a little trick to get better plans

Yes, you can force a table to be processed after other tables
by making it the right side of a left join. That's a better
practice than using explicit plans, but even better would be
to understand why the optimizer is choosing a bad join order
without the outer join.
> After I have "discovered" this I start to put the outer joins ate the
> end of the query but didn't know why... :-(
My guess is that you've got bad statistics on the index
FK_PEDIDOVENDAITEM_PRODUTO which is causing the optimizer
to under value it when processing the statement.