Subject | Re: default plan no good for many joins? |
---|---|
Author | Michael Fung |
Post date | 2003-07-17T07:00:45Z |
--- In firebird-support@yahoogroups.com, Helen Borrie <helebor@t...>
wrote:
Anyway your tips are very useful and cleared my worries, thanks a lot!
- Michael
wrote:
> >using in
> >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
> this plan, then the reason is that you failed to include the tableany
> identifier on the where criterion. It should be I.OUTS_QTY > 0 in
> 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