Subject Re[2]: [ib-support] Please help me with query plan
Author Daniel Rail
Hi,

> Daniel Rail wrote:

>>Try reorganizing your query.
>>
>>Here's how I would write it:
>>
>>select sum(x.Price*x.Qty/d.Rate)
>> from xfers x
>> inner join docs d on ((x.docid=d.id) and (d.customerid=x.dstid))
>> where (x.dstid=:id)
>> and (d.DepID=:dep)
>> and (d.DocDate<CURRENT_TIMESTAMP)
>> and exists (select *
>> from optypes t
>> where (t.id=x.typeid)
>> and (t.factor<>0))
>>
>>

> Default plan is the same for your version. I agree, reorganizing query
> is a better way.

Also, just to let you know(if you haven't heard already). Firebird
1.5 has some improvements in the query optimizer. I'm not too familiar
with those improvements, so I can't tell you if it would make any
difference. And, Firebird 1.5 is still in Alpha stage of development.

Daniel Rail
Senior System Engineer
ACCRA Group Inc. (www.accra.ca)
ACCRA Med Software Inc. (www.accramed.ca)