Subject | Re: [firebird-support] Advice on SQL omtimisation problem. |
---|---|
Author | Dimitry Sibiryakov |
Post date | 2004-03-18T10:49:38Z |
On 18 Mar 2004 at 14:48, Bradley Tate wrote:
As a last resort you can put this query into selectable SP and make
joins by hands.
SY, Dimitry Sibiryakov.
>I have been trying to get the following reasonably simple SQL toTry to move "IDRelate.Capacity = 'ADVISOR'" into WHERE part.
>optimize but cannot. Every time it's run it does a natural scan on
>IDRelate rather than using the index, which makes it much slower.
>
>select
> InvHead.IDRef,
> InvHead.InvHeadRef,
> InvHead.IHStatus,
> InvHead.FeePlanRef, idrelate.idlinkref
> from
> InvHead
> inner join IDRelate on
> idrelate.IDRef = InvHEad.IDRef and IDRelate.Capacity = 'ADVISOR'
> left outer join acctname on invhead.invheadref = acctname.invheadref
>where invhead.invheadref = 'IH00025809'
As a last resort you can put this query into selectable SP and make
joins by hands.
SY, Dimitry Sibiryakov.