Subject Re: default plan no good for many joins?
Author Michael Fung
--- In firebird-support@yahoogroups.com, Helen Borrie <helebor@t...>
wrote:
> >
> >SELECT I.ID
> > , P.PN
> > , B.NAME
> > , O.PO_NO
> > , S.SUPP_NO
> > , I.QTY
> > , I.OUTS_QTY
> > , U.NAME
> > , E.EMP_NO
> >
> >FROM PO_ITEM I
> > LEFT OUTER JOIN PO O ON O.ID = I.PO_ID
> > LEFT OUTER JOIN PRODUCT P ON P.ID = I.PRODUCT_ID
> > LEFT OUTER JOIN BRAND B ON B.ID = P.BRAND_ID
> > LEFT OUTER JOIN UNIT U ON U.ID = P.UNIT_ID
> > LEFT OUTER JOIN SUPPLIER S ON S.ID = O.SUPPLIER_ID
> > LEFT OUTER JOIN EMPLOYEE E ON E.ID = O.EMPLOYEE_ID
> >
> >WHERE
> > OUTS_QTY > 0
>
> If you have an index on PO_ITEM.OUTS_QTY that the optimizer isn't
using in
> this plan, then the reason is that you failed to include the table
> identifier on the where criterion. It should be I.OUTS_QTY > 0 in
any
> case (and should have failed in Firebird 1.5).


FYI this query does not fail and I am using FB 1.5RC3.

Anyway your tips are very useful and cleared my worries, thanks a lot!

- Michael